Rewrite https://domain.com to https://www.domain.com
2 posts
• Page 1 of 1
Rewrite https://domain.com to https://www.domain.com
I have the following site specific rule
RewriteCond %{HTTPS} off
RewriteCond %{HTTP_HOST} ^www\.domain\.com$ [NC, OR]
RewriteCond %{HTTP_HOST} ^domain\.com$ [NC, OR]
RewriteRule ^/(.*) https://www.domain.com/$1 [R=301,L]
RewriteCond %{HTTPS} on
RewriteCond %{HTTP_HOST} ^domain\.com$ [NC, OR]
RewriteRule ^/(.*) https://www.domain.com/$1 [R=301,L]
1) The purpose of this rewrite is to push all traffic to SSL with a www prefix
2) (working) [http://www.domain.com/test-v23.htm?test=123] -> redirects correctly
3) (working) [http://domain.com/test-v23.htm?test=123] -> redirects correctly
4) (working) [https://www.domain.com/test-v23.htm?test=123] -> redirects correctly
5) (error) [https://domain.com/test-v23.htm?test=123]
the second rule doesn't appear to trigger. x`
I've tried multiple ways but I can not get https://domain.com to rewrite to https://www.domain.com
Your help is always appreciated. A helicon customer for over 10 years...
RewriteCond %{HTTPS} off
RewriteCond %{HTTP_HOST} ^www\.domain\.com$ [NC, OR]
RewriteCond %{HTTP_HOST} ^domain\.com$ [NC, OR]
RewriteRule ^/(.*) https://www.domain.com/$1 [R=301,L]
RewriteCond %{HTTPS} on
RewriteCond %{HTTP_HOST} ^domain\.com$ [NC, OR]
RewriteRule ^/(.*) https://www.domain.com/$1 [R=301,L]
1) The purpose of this rewrite is to push all traffic to SSL with a www prefix
2) (working) [http://www.domain.com/test-v23.htm?test=123] -> redirects correctly
3) (working) [http://domain.com/test-v23.htm?test=123] -> redirects correctly
4) (working) [https://www.domain.com/test-v23.htm?test=123] -> redirects correctly
5) (error) [https://domain.com/test-v23.htm?test=123]
the second rule doesn't appear to trigger. x`
I've tried multiple ways but I can not get https://domain.com to rewrite to https://www.domain.com
Your help is always appreciated. A helicon customer for over 10 years...
Re: Rewrite https://domain.com to https://www.domain.com
Hello.
HTTPS should be NC as with some IIS versions it is 'on' and with others it is 'On'.
Please try:
RewriteCond %{HTTPS} off [NC]
RewriteCond %{HTTP_HOST} ^(?:www\.)?domain\.com$ [NC]
RewriteRule (.*) https\://www.domain.com$1 [R=301]
RewriteCond %{HTTP_HOST} ^domain\.com$ [NC]
RewriteRule ^(.*) https\://www.domain.com$1 [R=301]
HTTPS should be NC as with some IIS versions it is 'on' and with others it is 'On'.
Please try:
RewriteCond %{HTTPS} off [NC]
RewriteCond %{HTTP_HOST} ^(?:www\.)?domain\.com$ [NC]
RewriteRule (.*) https\://www.domain.com$1 [R=301]
RewriteCond %{HTTP_HOST} ^domain\.com$ [NC]
RewriteRule ^(.*) https\://www.domain.com$1 [R=301]
2 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 10 guests