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

By jason on 08/05/2013

yep, this is a handy statement for redirecting all requests from a sub-folder to the root of the site. Say, for example, you have originally built a drupal site in a subdirectory "/drupal" for example..then, say that some users used the ckFinder image uploader to upload files..and 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.

website redirect rule