301 Redirect

When you move a new site into Drupal or change your URL aliases for optimization purposes, it's a good idea to redirect your old page urls to the new ones in order to retain any backlinks and page rank while improving your linking structure. Performing a 301 redirect in your .htaccess file is how you would go about doing this. However, the standard code for this does not work in Drupal when running clean URLs. Instead you will need to rewrite the URL by adding the following code below the RewriteEngine command in your .htaccess file.

RewriteBase /

RewriteRule ^old/URL/path$ http://yourdomain.com/new/path [R=301,L]

The old path is the relative url off the root and the new path is the absolute url you want to redirect to including the domain. Make sure that this code is placed above Drupal's clean url rewrite commands.

Posted In