The 301 Permalink Redirect” is the most effective and friendly for search engines a method to redirect Web sites. It can be used in different situations, including:

  • Redirect the old site to the new address
  • to create multiple domains pointing to one site
  • to ensure only one version of their site (with www or without www)
  • to synchronize the changes in the structure of the URL

There are several ways to install 301 redirection. Let’s look at the most commonly used of them:

PHP redirection of static pages

in order to redirect the static pages to a new address, simply insert this code inside the file index.php.

header("HTTP/1.1 301 Moved Permanently"); the

PHP Canonical

Canonical Redirection redirection of add or delete the www. Prefixes for all pages within the domain. The code below will redirect visitors from the

if (substr($_SERVER['HTTP_HOST'],0,3) != 'www') {
header('HTTP/1.1 301 Moved Permanently'); the
header('Location: http://www.'.$_SERVER['HTTP_HOST']

Apache .htaccess redirects the Static Pages

In order to apply this method, you need to add code in the .htaccess file. If there is no file, create it and put in the root directory of your site. The code can be added by using a plain text editor.

Redirect 301 /old/oldpage.htm
/new Http://

Apache .htaccess file, the canonical Redirect

This method is similar to that described above. Changes to the code that will redirect visitors from to

Options FollowSymlinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^$
RewriteRule ^(.*)$$1 [R=301,L]


Please enter your comment!
Please enter your name here