Answer the question
In order to leave comments, you need to log in
How to properly set up a request redirect in .htaccess?
Good day to all!
Please help me with .htaccess
There is a site root. It contains the .htaccess file, which should redirect all requests to the /public folder.
Here is its content:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^(.*)/$ /$1 [L,R=301]
RewriteRule ^(.*)$ public/$1 [L]
</IfModule>
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
Answer the question
In order to leave comments, you need to log in
I think it's obvious
, as I understand it, you filed your CNC there.
And therefore, the laws are the same
if you need to exclude all directories
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ public/$1 [L]
RewriteCond %{REQUEST_URI} !^/images/.*
RewriteRule ^(.*)$ public/$1 [L]
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question