Changing the root folder via .htaccess

If I’m understanding correctly, the following should work

RewriteEngine On

RewriteCond %{REQUEST_URI} !^/public/
RewriteRule ^(.*)$ /public/$1 [L,R=301]

This will redirect all requests that do not begin with /public/ to URL that does.

Hope that helps.

Leave a Comment