I am migrating an older site to a newer one which is using Drupal. As part of this I am trying to setup some 301 redirects to the new pages but I am getting some unexpected behavior. I added the following line to my .htaccess file:

redirect 301 /redirect.html http://www.example.com/newpage

Unfortunately, what happens is that I get taken to:


Which of course doesn't load correctly. Any thoughts?

  • I have a question about your question. Did clean urls configure correctly? Commented Aug 24, 2010 at 9:19
  • Clean urls did configure correctly. Commented Oct 7, 2010 at 0:50
  • The above directive alone would not have resulted in the redirect stated, so it's likely there was a conflict. Particularly since Drupal uses mod_rewrite and the above is a mod_alias directive. You should never mix redirects from both modules.
    – MrWhite
    Commented Dec 16, 2015 at 1:03

4 Answers 4


So after a bit of searching, I found the answer here. It is similar to danlefree's but slightly diffrent.

<IFModule mod_rewrite.c>
    RewriteEngine on
    RewriteBase /

    # custom redirects

    RewriteRule ^redirect\.html$ http://www.mysite.com/newpage [R=301,L]

    # end custom redirects


This seems to get the job done.

  • Ditto! But I still think you should look at my answer ;)
    – cgp
    Commented Aug 18, 2010 at 13:11
  • 1
    Instead of hacking around at the Apache level, consider using an appropriate Drupal module - it gives you a lot more power and flexibility.
    – Bevan
    Commented Aug 19, 2010 at 20:48

Forget .htaccess. Use the global redirect. It gives you the following:

  1. Checks the current URL for an alias and does a 301 redirect to it if it is not being used.
  2. Checks the current URL for a trailing slash, removes it if present and repeats check 1 with the new request.
  3. Checks access to the URL. If the user does not have access to the path, then no redirects are done. This helps avoid exposing private aliased node's.

It simplifies migration of your website slightly, and probably most important, it makes it simple to look up exactly what is being redirected where. (as there is a user interface for it)

Bonus (imagine clippy popping up here)

You seem to be creating something similar to clean URLs. I think you might be interested in pathauto.

  • Good suggestion - I was going to recommend Path Redirect for similar reasons.
    – Bevan
    Commented Aug 19, 2010 at 20:47
  • I looked into this and it conflicted with the Gallery module we had installed. Commented Aug 20, 2010 at 20:44

Your other rewrite rules are interfering.

Try the following instead:

RewriteEngine on

RewriteRule ^/redirect\.html$ http://www.mysite.com/newpage [L,R=301]

# ... existing rewrites
  • Unfortunately, this doesn't seem to be working for me. Commented Aug 18, 2010 at 4:20
  • This would have worked in the server config. However, in per-directory .htaccess files the directory-prefix is removed from the URL-path that matches against the RewriteRule pattern. So, the slash (/) should simply be removed from ^/redirect\.html$ to become ^redirect\.html$.
    – MrWhite
    Commented Dec 16, 2015 at 1:12

We used to Path redirect module for that purpose. It can't handle all powerful things that Mod_rewrite can, but it's done a really nice job for us at preserving old URLs.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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