How To Do A 301 Redirect
I always have to Google how to do a 301 redirect so I figured to put my own guide on my blog.
Doing a 301 redirect using this method is only if you own your own domain name and can access the server.
It is important to use one URL for your blog or website, with or without the www in the front. On this blog I have chosen to use the www, but on others I haven’t.
If someone links to saying BloggingAddiction.com and I don’t forward that to www.BloggingAddiction.com the link may not count for the www address. I usually prefer just http://bloggingaddiction.com.
If you haven’t set your preference yet, it’s easy. Just log on to your server with an FTP program (I use filezilla) and fine the .htaccess in the root directory. Download it and open it with notepad. Then insert the following code after what is already in there but before the #END WordPress tag.
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www\.YOURDOMAIN\.com$ [NC]
RewriteRule ^(.*)$ http://YOURDOMAIN.com/$1 [R=301,L]
Of course you need to substitute the YOURDOMAIN with your own address. Make sure not to remove any of the slashes or code otherwise it won’t work.
Save the changes and upload the .htaccess back to your server.
Now anytime you type in www.yourdomain.com it will redirect without the WWW. Therefore all of your inbound links will count to that version of your domain, which could make your pagerank and SERPs better.
[Source Blog-Op]


Leave a Reply