views:

164

answers:

3

How do you remove a folder from the URL? I have a Drupal installation in a folder and I would like to remove that subfolder from the URL.

So instead of:

www.example.com/subfolder/*

I would like the url to be:

www.example.com/*

thanks

+2  A: 

try

RewriteRule (.*) /subfolder/$1 [L]
valya
oh, @Gumbo solutions are better!
valya
A: 

You need to capture the .* like this:

RewriteRule ^(.*)/$ /$1/subfolder/ [L]

"subfolder" should come before "$1".
outis
(.*) eats all avaiable characters, so no need to ^, i think
valya
+3  A: 

Try this:

RewriteRule !^subfolder/ subfolder%{REQUEST_URI} [L]

And to redirect direct requests of /subfolder/…:

RewriteCond %{THE_REQUEST} ^GET\ /subfolder/
RewriteRule ^subfolder/(.*) /$1 [L,R=301]

Or, even better, change your document root to that subfolder.

Gumbo