Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Archive

Our old forums are still available as a read-only archive.

Moderators: martimiz, Sean, biapar, Willr, Ingo, simon_w

How to Redirect WWW to Non-WWW with htacess


Reply

3 Posts   1569 Views

Avatar
socks

26 October 2008 at 9:33am (Last edited: 26 October 2008 9:36am), Community Member, 190 Posts

I usually do this in the htacess:

RewriteCond %{http_host} ^www.mywebsite.com/ [NC]
RewriteRule ^(.*)$ http://mywebsite.com/$1 [R=301,NC]

but it isn't working. Any suggestions?

thanks,
Clint

Avatar
simon_w

26 October 2008 at 10:48am (Last edited: 26 October 2008 10:52am), Forum Moderator, 474 Posts

RewriteCond %{HTTP_HOST} ^www.simon.geek.nz$
RewriteRule ^(.*)$ http://simon.geek.nz/$1 [R=301,L]

Works fine for me. Note, there's no trailing slash on the domain name, which appears to be your problem.

Avatar
socks

26 October 2008 at 11:04am Community Member, 190 Posts

I changed the "/" to a "$" and I also had to specify the RewriteRule as the Last rule with the "L".

Thanks for your help.