Effective SEO & Web Studio
Redirect Permanent (301) Tricks for On-Page SEO

Permanent Redirect 301 for better SEO

Jan 5, 10:55 PM in

Redirect 301 or Permanent Redirect is a rather self-explanatory term, isn’t it?. What do we need it for? If you changed page URL and that URL is still indexed by Google or linked to from other websites it is better to take care of it in a proper way. What can be more proper way that redirection to a new page. If these measures are taken the site visitor will get to the right page. Otherwise a confused visitor will see 404 warning that page he is looking for no longer exist. In most cases site visitors just leave the site without continuing searches. Therefore, why should one confuse visitors with that scary 404 thing if one can redirect them to where they should be.

First, in the Google Webmasters Tools one should find problem pages that robots failed to find. Sometimes some sites may link to a wrong page or page that never existed by mistake. For example, your page is www.site.com/interesting-news.htm but some news magazine liked your article and mistakenly referred to it as www.site.com/interesting-news.html. These can happen. Therefore knowing some redirect tricks is useful.

Second, one has to locate .htaccess file though some FTP client or file manager. The below listed are the methods that can be applied in .htaccess file only.

If a page or directory addresss (URL) has been changed for some reasons it is important to enable accessibility of the new address. There are some methods of redirect from old pages to new ones. Below we will consider some of them including those for particular CMS. The more new techniques will be added with time.

If you moved to the new domain the simplest way is to add to .htaccess file lines:

Redirect 301 / www.newdomain.com

or Redirect Permanent

Redirect Permanent /old-page www.site.com/new-page

Sometimes in some CMS this easy rule not that easy. Why not try this one:

RewriteRule ^/old-page.html(.*)$ http://www.site.com/new-page.html [L,R=301]

Or redirect from entire old section to the new one.

RewriteRule ^old-blog-section(.*)$ http://www.site.com/new-blog-section/ [L,R=301]

If you need to remove duplicate pages by directing them from those with .php or .html to their directories.

RewriteRule ^(.*)index\.(html|php)$ http://%{HTTP_HOST}/$1 [R=301,L]

When applied, site’s page will look like this:

http://site.com/about/

Instead of

http://site.com/about/index.php 

Thus all URLs from www.site.com/old-blog-section/article1.html, www.site.com/old-blog-section/article2.html etc will be redirected to the new section page.

From SEO standpoint it is not recommended that site would be accessed both as www.site.com and site.com without www. You have to see which version search engines prefer, then enable redirect. To redirect from www.site.com to site.com can be done by this

Options +FollowSymLinks
RewriteEngine On
RewriteCond %{HTTP_HOST}	^www\.(.*)	[NC]
RewriteRule ^(.*)$ http://%1/$1	[R=301,L]

or this

Options +FollowSymLinks
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www.domain\.com$ [NC]
RewriteRule ^(.*)$ http://domain.com/$1 [R=301,L]

The opposite proccess is redirect from site.com to www.site.com:

Options +FollowSymLinks
RewriteEngine On
RewriteCond %{HTTP_HOST} ^domain\.com$ [NC]
RewriteRule ^(.*)$ http://www.domain.com/$1 [R=301,L] 

or alternative method:

RewriteEngine On
RewriteCond %{HTTP_HOST}	!^www\.(.*)	[NC]
RewriteRule ^(.*)$ http://www.%1/$1	[R=301,L]

Redirect 301 for Joomla

CMS Joomla may have some ugly duplicate homepage URLs like this one:

www.site.com/index.php?option=com_content&view=frontpage

To get rid of it we can try this rule in .htaccess file:

Options +FollowSymLinks
RewriteEngine on
RewriteCond %{QUERY_STRING} ^option=com_content&view=frontpage$
RewriteRule ^(index\.php)?$ http://www.site.com/? [R=301,L]

This way

www.site.com/index.php?option=com_content&view=frontpage 

is redirected to

www.site.com

Often search engines display search results of Joomla homepages as www.site.com/index.php instead of www.site.com. To redirect first to the second we can put this rule in .htaccess file:

RewriteCond %{THE_REQUEST} ^.*/index\.php 
RewriteRule ^(.*)index.php$ /$1 [R=301,L] 
RewriteCond %{THE_REQUEST} ^.*/index\.php 
RewriteRule ^(.*)index.php/$ /$1 [R=301,L] 

Or you can try the univesal method of reditecting to home page from all possiple url like www.site.com/index.php, www.site.com/default.html, www.site.com/main.html

RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^/]+/)*(default|index|main)\.(html|php|htm)\ HTTP/ [NC]
RewriteRule ^(([^/]+/)*)(default|main|index)\.(html|php|htm)$ http://www.site.com/$1 [L,R=301]

Redirect 301 for OpenCart

OpenCart has a strange homepage tail

This short lines solve the problem:

RewriteCond %{QUERY_STRING} ^route=common/home$
RewriteRule ^index\.php$ http://site.com/? [R=301,L]

Original OC category page looks like this

www.site.com/index.php?path=83_94_113&route=product/category.

If looking at it you decided to turn on SEO urls in your OpenCart shop admin, for SEO purposes it is advisable to ebanle redirect form the ugly one to the nice one

If SEO url of the category is www.site.com/new-category, for example, this lines will help you solve the issue:

RewriteCond %{QUERY_STRING} ^path=83_94_113&route=product/category$
RewriteRule ^index\.php$ http://site.com/new-category? [R=301,L]

Redirect 301 for Textpattern

In TXP there is little trickyredirect from dynamic category URL that looks like:

www.txpnow.com/articles/?c=category

Lets try this one:

RewriteCond %{QUERY_STRING} ^c=category$ [NC]
RewriteRule katalog http://site.com/? [R=301,L]

This one redirect from www.txpnow.com/articles/?c=category to site homepage.