Seattle Web Design
Blog > Apache Redirects to WWW and without WWW version of website

Meet the author:
Jill Olkoski

Jill has a MA in Clinical Psychology, a BS in Computer Science, and a BS in Mechanical Engineering.

She currently owns Aldebaran Web Design in Edmonds (near Seattle WA) and enjoys educating her clients on topics related to small business website design.

In Jill's previous life, she spent 17 years in the engineering and quality organizations of a Fortune 100 tech company.

 


Apache Redirects to WWW and without WWW version of website

October 17th, 2014

It’s good for search engines, like Google, to only have one version of your website indexed. To Google, the www.yourdomain.com and yourdomain.com are not the same. You can use this code on Apache servers inside a .htaccess file. It’s worked for me on several different hosting companies.

To redirect to without www version:

RewriteEngine on
RewriteCond %{HTTP_HOST} ^www.yourdomain\.com
RewriteRule ^(.*)$ http://yourdomain.com/$1 [R=permanent,L]

 

To redirect to the www version:

RewriteEngine on
RewriteCond %{HTTP_HOST} ^yourdomain\.com
RewriteRule ^(.*)$ http://www.yourdomain.com/$1 [R=permanent,L]

Jill
--------------
J. Olkoski
Aldebaran Web Design, Seattle
Jill Olkoski has a BS in Engineering, a BS in Computer Science and an MA in Clinical Psychology. She delights in using her advanced technical and psychological skills to help small business owners develop cost-effective and successful websites.



Comments are closed.



 ©2006 - © Aldebaran Web Design Seattle, A DBA of Aldebaran Services LLC
Blog Email Subscription:
Search Blog Articles: