Adding 301 permanent redirects in Apache using htaccess
You can easily add 301 page redirects to your website with Apache htaccess files. A 301 permanent redirect is the most efficient and SEO friendly way for web page redirection. It’s relatively simple to implement and, if done properly, improves your search engine rankings as well.
One basic use of a 301 permanent redirection is to redirect yourdomain.name to www.yourdomain.name. This way, when someone tries to access your website without the www, it will redirect the URL to your website with the www. This practice prevents the duplication of URL’s for the same web page, making your website more friendly to search engines. It also ensures that your site’s inbound links are all counted towards the same URL – and not divided into www.yourdomain.name and yourdomain.name.
To implement this for your website follow these instructions:
1. Open up notepad or any other text editor and copy and paste the commands below.
2. Change (yourdomain) to your domain name.
3. Save the file with this name: (.htaccess). There is no file name.
4. Upload it to the root directory of your website.
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{HTTP_HOST} ^yourdomain\.com$ [NC]
RewriteRule ^(.*)$ http://www.yourdomain.com/$1 [R=301,L]
Moving Stores? Redirect Your Entire Web Directory URL
If you are switching to Magento and Ultimento from another site you may be concerned about losing incoming links or SEO rankings. Whenever you change your site’s URL structure you need to redirect entire directories of your website to ensure that no links are lost.
For example, you may have a product link called www.yourdomain.com/cat1/subcat1/ that’s been collecting SEO history and now you want to change it to just www.yourdomain.com/subcat1 to make it easier to remember for customers and to improve SEO rankings. You want all of your internal links (such as “/Web-Design-Blog/post-permalink/”) to permanently redirect to “/blog/post-permalink/”.
To redirect all of the links in a web directory to a new directory you have to add the following line to your .htaccess file:
redirect 301 /old-directory http://www.yourwebsite.com/new-directory
Where “www.yourwebsite.com” is your site’s domain name. That’s it.
