Redirecting Requests From A Sub-Folder To The Root Of The Site

By jason on 12/11/2015

This is a handy statement for redirecting all requests from a sub-folder to the root of the site. Let's say, hypothetically speaking, that you have originally built a drupal site in a subdirectory "/drupal". Then, let's say that some users used the ckFinder image uploader to upload files. Perhaps your designer used some references in the css (and or theme) to /drupal/image. Well, to save yourself from headaches, and buy some time while fixing the url's within the site, use this statement:

RewriteRule ^subdir/(.*)$ /$1 [R=301,NC,L]

Sweet, sweet magic.

If you're putting it in Drupal's .htaccess file, just make sure it goes above any other rewrite rules.
Enjoy. Who loves web design in Boise? We do, we also love the development challenges that come with it.

-Jason

website redirect for seo