Redirect www.site.com to site.com
- Dkov
- Posts: 3
- Starts: 2
- Wiki Edits: 0
- Location: Boulder, Colorado
How can I redirect visitors from www.mysite.com to mysite.com? I tried through the Redirects portion of the control panel but it didn't seem to work. Every time I thought I was setting it up properly, the confirmation said I was redirecting mysite.com to mysite.com.
- Rahul
- Posts: 509
- Starts: 0
- Wiki Edits: 1
I hope the following rewrite rule will help you to do so.
RewriteCond %{http_host} ^www.mysite.com [nc]
RewriteRule ^(.*)$ http://mysite.com/$1 [r=301,nc]
RewriteCond %{http_host} ^www.mysite.com [nc]
RewriteRule ^(.*)$ http://mysite.com/$1 [r=301,nc]
2008-01-14 11:18 PM
Regards,Rahul
- Dkov
- Posts: 3
- Starts: 2
- Wiki Edits: 0
- Location: Boulder, Colorado
Thanks Rahul. I had trouble with it because I made it the last rewrite rule. It worked great once I figured out that it need to be the first rule.
2008-01-15 09:13 PM
- Chap
- Posts: 5
- Starts: 3
- Wiki Edits: 0
This seems to have worked better for me.
In my .htacces
In my .htacces
Options +FollowSymLinks
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} !^askapache\.com$ [NC]
RewriteRule ^(.*)$ http://askapache.com/$1 [R=301,L]