Readmore
Readmore
Readmore
arrows
arrows
arrows
Watchvideo
Visitblog
Visitservices
Visitwork
Advertising

How to redirect URLs using 301 redirection

This is probably one of the most frequently asked forum questions when we talk about redirections.

Mario Francesevic 17 years ago
dots dots

This is probably one of the most frequently asked forum questions when we talk about redirections. Besides, we could say that the 301 redirection is one of the things that needs to be done if we want to:

redirect old domain to a new one

correctly organize the URL structure by selecting www. or without www prefix

set redirection from several domains to only one site

help search engines to reindex the site which was transfered to the new domain using multiple redirection

One of the reasons the 301 redirection must be done is the fact that is takes only 5 minutes (ok, lets rule out the situation where you need to redirect about 500 different URLs), some good will — and instructions on the process of redirection. I’ll give you some of the ways in which this process can be done, but really, it shouldn’t take longer than a couple of minutes for each one to be done…

Redirection of an old domain to a new one

This method can be applied in case you are using Linux hosting and the server gives you the option of mod_rewrite. In case you are not sure that mod_rewrite is available, check can be done this way. After that, create .htaccess file to which you will copy the next code and save it to the root directory:

Options +FollowSymLinks
RewriteEngine on
RewriteRule (.*) http://www.novadomena.com/$1 [R=301,L]

Redirection of non-www to www version

Copy into .htaccess file:

Options +FollowSymlinks
RewriteEngine on
rewritecond %{http_host} ^domena.com [nc]
rewriterule ^(.*)$ http://www.domena.com/$1 [r=301,nc]

This will enable redirection from non-www to www version. The reason this method is applied has been already explained on this blog, but it won’t do any harm to repeat again:

because of the difference in the domain prefix, some deviations in the number of backlinks and pagerank are possible (to be more exact, the deviations are referred to the value of the link) because, technically, it is about two differnet domains (links)

PHP redirection

In case you need redirection of one file, it can be done by entering the following code into the same page:

Header( "HTTP/1.1 301 Moved Permanently" ); 
Header( "Location: http://www.novi-url.com" );

ASP redirection

For ASP users, the method from above should look like this

 <%@ Language=VBScript %>
Response.Status="301 Moved Permanently"
Response.AddHeader "Location","http://www.novi-url.com/"

Redirection with WordPress

For WordPress fans, there is a plugin that helps you to make 301 redirection.

Newsletter

We’ll need your email If you want to hear our two cents on the industry’s latest. We’re certain it will be worth your time, well, at least worth more than two cents.