0

I had a site, say example.com/drupal running on xampp

I have since changed the DocumentRoot in httpd.conf to /drupal/, so that I could access my site using example.com

But Google has already crawled my site and shows results of the form

example.com/drupal/something

which of course go to 404 pages.

How do I use RewriteRules to redirect

example.com/drupal/something

to

example.com/something ?

1

I'd simply use the standard Apache RedirectPermanent directive instead of bothering with attempting to use the relatively expensive Rewrite engine.

Check out http://httpd.apache.org/docs/2.2/mod/mod_alias.html#redirectpermanent

1
RewriteRule ^/drupal$ /
RewriteRule ^/drupal/(.*) /$1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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