05 Jul, 2007
www vs. non-www 301 redirect
Web Development » Snippets, Tutorials » www vs. non-www 301 redirect
If you would like to force all your incoming URLs to have www at the front for SEO reasons, create an .htaccess file with the following content in the root directory of your website.
RewriteEngine on
RewriteCond %{HTTP_HOST} ^example.com [NC]
RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301]
What is 301 redirect?
301 redirect is the most efficient and Search Engine Friendly method for webpage redirection. It’s not that hard to implement and it should preserve your search engine rankings for that particular page. If you have to change file names or move pages around, it’s the safest option. The code “301″ is interpreted as “moved permanently”.
Source: How to Redirect a Web Page
Recommend Book
Technorati Tags: 301 redirect, htaccess, search engines, seo
Other similiar posts that you might be interested in:
- How to redirect old pages to new pages using htaccess
- Removing file extension via .htaccess
- Google custom search engine
- Redirect to homepage when page not found
- Content Encoding Error in Joomla
- Useful Tools and Tips for Search Engine Optimisation Consultants
- Enabling gd image library in PHP (Windows)







