Answer the question
In order to leave comments, you need to log in
How to setup .htaccess if index.php is not in project root?
index.php is a single entry point.
If .htaccess and index.php are in the root of the project, everything works, but if they are moved to the public folder, then of course it doesn’t work. What is the correct way to write a rewrite rule if both of these files are not in the project root?
Answer the question
In order to leave comments, you need to log in
All requests that go to the root of the project are redirected to the public folder
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^$ public/ [L]
RewriteRule ((?s).*) public/$1 [L]
</IfModule>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question