M
M
Merkalov2017-08-02 09:03:39
htaccess
Merkalov, 2017-08-02 09:03:39

How to setup .htaccess if index.php is not in project root?

281bbbea9f204c4aa0f2832c64806b5e.JPG
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

1 answer(s)
A
Andrey Sanych, 2017-08-02
@Merkalov

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 question

Ask a Question

731 491 924 answers to any question