I have a peculiar problem in that people visit any other page other than the homepage with the "www." before the url they will receive an error.

If they visit the index with the "www." it is removed and whatever links they click will work as it doesn't have the "www." in front.

http://www.domain.com/        - will change to http://domain.com and work fine
http://www.domain.com/about   - will return '404 Not Found'
http://domain.com/about       - will work fine

I have Clean URL's installed (but I can't seem to change any settings in it) and I don't remember touching the .htaccess file.

Any help is much appreciated, thanks.

1 Answer 1


The following rules remove the www everywhere on your domain. Put it in .htaccess file:

  RewriteEngine On
  RewriteBase /
  RewriteCond %{HTTP_HOST} ^www.yourdomain.com [NC]
  RewriteRule ^(.*)$ http://yourdomain.com/$1 [L,R=301]
  • 1
    But I wouldn't mind users being able to do either or (www or not www). Is this not possible? Thanks for your reply. Feb 14, 2012 at 12:06
  • With the above script, people can type www. but will be redirected to the non www. version of the site.
    – dimitril
    Feb 14, 2012 at 12:22
  • I understand what the script does, but I was asking if it's possible to have no redirect for www. and no www. (completely user preference). Feb 14, 2012 at 19:52
  • @Matt This will be very bad for SEO a.k.a "duplicate content".
    – user11153
    Apr 4, 2013 at 11:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.