Forum Moderators: phranque

Message Too Old, No Replies

.htaccess problems

         

PiisAI

10:45 am on Aug 26, 2006 (gmt 0)

10+ Year Member



here is my .htaccess file located in the sub-directory "sub" of domain "domain.com". The sub-domain "sub.domain.com" is pointing to the sub-directory "sub":

RewriteEngine on

RewriteCond %{HTTP_HOST} ^www.sub.domain.com$
RewriteRule ^(.*)$ [domain.com...] [R=301,L]

RewriteCond %{HTTP_HOST} ^sub.domain.com$
RewriteRule ^(.*)$ [domain.com...] [R=301,L]

RewriteCond %{HTTP_HOST} ^domain.com$
RewriteRule ^(.*)$ [domain.com...] [R=301,L]

RewriteCond %{SERVER_PORT}!443$
RewriteRule ^(.*)$ [domain.com...] [R]

Here are my goals:

1) redirect all requests of www.sub.domain.com to www.domain.com/sub/

2) redirect all requests of sub.domain.com to www.domain.com/sub/

3) redirect all requests of domain.com to www.domain.com/sub/

4) Have all redirects redirecting to HTTPS

My problem:

when i try to access "http://sub.domain.com/file.html" it will redirect to "https://domain.com/sub/file.html" rather than "https://www.domain.com/sub/file.html"

[edited by: PiisAI at 10:46 am (utc) on Aug. 26, 2006]

jdMorgan

3:34 am on Aug 28, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Because it's obvious your code isn't doing this, it looks like your server is configured with "UseCanonicalName on" -- Contact your host if you do not have httpd.conf access, and ask them to turn it off. Or to change the ServerName for your account to your preferred canonical domain name with "www".

Jim