Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have moved my old website from static html pages to drupal. Now I want to redirect old pages that I now get 404 errors upon request, to new drupal nodes.

What is the best approach to do this and how? Can it be done using .htaccess directives?

share|improve this question
up vote 2 down vote accepted

If you don't know what the address was, making a catch-all url would be a good way but that may cause some problems to drupal's working parts.

If you know the url of the old pages you can create a simple map or just simple rules with the .htaccess would be the safer route.

An example of catch-all would be:

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !^/index.php$
RewriteRule . index.php

The above rules would redirect anything that is not a existent file or folder within your domain and not index.php and redirect it do index.php.

The other way would be knowing the urls and doing something like this:

RewriteEngine on
# screenshot's page
RewriteRule ^(screenshot.html)$ index.php?section=screenshot [R=301,L]

There might be other ways too but these 2 were what i could thing right away.

share|improve this answer
Thanks. The latter is what I was looking for and it works fine, but it actually rewrites the URL rather than forwarding it. I want the new URL to be seen in browser's address bar. Any ideas? – Hamid Oct 6 '10 at 15:40
fixed :) all you need is the flag 'R=301,' with L becoming [R=301,L] the 301 means it is a permanent redirect and if u use 302 it means temporary redirect. – Prix Oct 6 '10 at 15:52
Works like a charm. Thanks. What does L mean? – Hamid Oct 6 '10 at 16:00
[L] means that this rule is the last one if rule is applied – Prix Oct 6 '10 at 17:11

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.