05 Jul, 2007
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
Love what you've just read? Subscribe to our newsletter to receive tips, resources and special offers related to web development & design.
Other similar 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
- How to customise your Facebook Fan Page with FBML

Hello! Welcome to Web development blog! My name is Ei Sabai and on this blog, I write about web development, mobile app development, latest web technologies and the likes. Read more 


Nice summary. I wrote a slightly more detailed version on my personal blog – http://www.web-design-talk.co.uk/20/301-redirects-for-seo-using-htaccess/