bcmcfc
bcmcfc

Reputation: 26795

htaccess invisibly redirect everything into a directory

How do I redirect all requests into a subdirectory?

I've tried this, and lots of other things:

RewriteEngine on
RewriteCond %{REQUEST_URI} ^/webroot/(.*)
RewriteRule $ webroot/$1 [NC,L]

What I want is to protect the contents of the otherwise web-accessible directory the requests would ordinarily go to, and have them mapped onto the webroot directory.

Upvotes: 0

Views: 96

Answers (1)

LazyOne
LazyOne

Reputation: 165343

The rule below will rewrite (internal redirect) EVERYTHING into /webroot/ subfolder:

RewriteEngine On
RewriteBase /

RewriteCond %{REQUEST_URI} !^/webroot/
RewriteRule ^(.*)$ /webroot/$1 [L]

Upvotes: 1

Related Questions