Drupal: How To Save URLs Moving To Drupal
When moving your site from one engine to another one, pages’ URLs are changed and you ma need to save oold URLs. First, there are links to these URLs from other sites, and search engines stores old URLs in index some time. This article will tell you how to save old URLs.
Solution
There are no old URLs anymore, but the can be used. We should create 301 redirect from old URL to a new one.
Alternatives
- Redirect from old URL to new one in .htaccess file
- Redirect from old URL to new one with the help of Pathauto and Global Redirect modules
Redirect from old URL to new one in .htaccess file
The simplest method:
add
RewriteCond %{REQUEST_URI} ^/old_url_1.html
RewriteCond %{REQUEST_URI} ^/old_url_2.html
RewriteCond %{REQUEST_URI} ^/old_url_3.html
RewriteCond %{REQUEST_URI} ^/old_url_N.html
RewriteRule ^(.*)$ http://site.ru$1 [R=301,L]
in .htaccess file (in the site root) after:
<IfModule mod_rewrite.c>
RewriteEngine on
Redirect from old URL to new one with the help of Pathauto and Global Redirect modules
The other method is to use Pathauto module with Global Redirect. Create one more synonym for a node in admin area. When calling this snonym, Global Redirect will redirect to main node alias.
In this case data is stored in database and Drupal would be loaded for redirect. So performance will go down. And if you wish to disable such redirect, it will take you more time.