How to do 301 redirect in a drupal with the htaccess file

Note: All the instructions bellow are for do in the htaccess file.
  1. Uncomment the command RewriteBase if the site is running in a VirtualDocumentRoot at http://example.com/ or uncomment the command RewriteBase /drupal if you are using Drupal in a subdirectory or in a VirtualDocumentRoot at http://example.com/drupal
  2. Add the following code below the RewriteEngine command in your .htaccess file RewriteRule ^old_file_name http://www.example.com/new-file-name [R=301,L]
  3. Replace old_file_name with the path to the old file which you wish to have redirected and then replace http://www.example.com/new-file-name with the complete path to the new page.

One additional note, if you put these changes bellow the rewrite statement and before any other redirects, it works better

Comments are closed.