PHP webdeveloper and frontend developer

Add www to your domain or remove the www from your domain

Category : Apache · by May 26th, 2009

Add www in front of your domain

This is important not only for aesthetic reasons, but for SEO (Search Engine Optimization). Forcing www before your domain or removing it prevents search engines from ending up with duplicate results and different page ranks per page. Some websites don‘t even return a page when you leave out the www. This depends on how your webserver is set up. To force the www to be added before the domain, make a .htaccess file in your root folder of your website containing these lines:

 You have to fill in your domain on the first line and second line. The R=301 flag means the user is going to be visually redirected to the domain containing the www in front of it.

Remove www from your domain

To remove the www from your domain, do the same as above but with these lines:



Leave a Reply

Your email address will not be published. Required fields are marked *