domain.com to www.domain.com redirection
3 posts
• Page 1 of 1
domain.com to www.domain.com redirection
Hello,
I have eventually got Helicon Ape working within a Win2008R2 x64 / WSP environment, however I am having one particular issue.
The redirection from domain.com to http://www.domain.com is not working. I might just revert back to IIS Rewrite for this job, however before I start changing everything I wanted to know if the following code should work:
I understand that this should do that job, however it causes a redirect loop when trying to use 'www.domain.com'.
Any help would be greatly appreciated
I have eventually got Helicon Ape working within a Win2008R2 x64 / WSP environment, however I am having one particular issue.
The redirection from domain.com to http://www.domain.com is not working. I might just revert back to IIS Rewrite for this job, however before I start changing everything I wanted to know if the following code should work:
- Code: Select all
RewriteRule ^(.*) http://www\.domain\.com/$1 [R=301,L]
I understand that this should do that job, however it causes a redirect loop when trying to use 'www.domain.com'.
Any help would be greatly appreciated
- HeliconAndrew
- Posts: 1264
- Joined: 07 Mar 2012, 10:16
Re: domain.com to www.domain.com redirection
The classic rule from our examples page would be:
you may simplify that to:
Regards
Andrew
- Code: Select all
RewriteCond %{HTTPS} (on)?
RewriteCond %{HTTP:Host} ^(?!www\.)(.+)$ [NC]
RewriteCond %{REQUEST_URI} (.+)
RewriteRule .? http(?%1s)://www.%2%3 [R=301,L]
you may simplify that to:
- Code: Select all
RewriteCond %{HTTP:Host} ^(?!www\.)(.+)$ [NC]
RewriteCond %{REQUEST_URI} (.+)
RewriteRule .? http://www.%1%2 [R=301,L]
Regards
Andrew
3 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 22 guests