2

I have an established Drupal installation at example.com/drupal - and now I need to move the installation up one level to the domain root.

So the rewrite rule I need is to redirect all existing URLs - e.g. example.com/drupal/some_section/somepage to example.com/some_section/somepage etc.

How do I do this?

2 Answers 2

7

Try this:

RewriteEngine On
RewriteBase /

RewriteRule   ^drupal/(.+)$   $1

Hope this helps

2
  • +1. I just unsure if this will be enough -- maybe 301 redirect will be required (instead of just rewrite as Drupal may detect original URL (sorry, I'm not familiar with Drupal at all)) + Drupal config change ... but that is up to OP to figure out.
    – LazyOne
    Jul 20, 2011 at 12:41
  • Yes, I believe you're right Lazy... I'll need to test this. It may not be workable after all.
    – Michael D
    Jul 20, 2011 at 15:30
0

Rewriting URLs like example.com/drupal/... will help if people go to example.com/drupal/... but it seems you want it the other way: people use example.com/... and go to you site.

For that, I think you need to change the DocumentRoot in your web server configuration or setup a virtual host for example.com

3
  • Imagine that the site is already moved. Now I just want the old URLs that are still being used by various sources to redirect to the new locations.
    – Michael D
    Jul 20, 2011 at 15:28
  • @Michael For that you definitely want to do 301 Permanent Redirect, especially from SEO point of view.
    – LazyOne
    Jul 21, 2011 at 0:40
  • Thanks LazyOne. You are right, and I've done the 301 Permanent Redirect. Works good.
    – Michael D
    Jul 22, 2011 at 9:20

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

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

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