V
V
Vanik Khachatryan2018-02-09 20:22:19
Nginx
Vanik Khachatryan, 2018-02-09 20:22:19

How to make a redirect to index.php for any access to the site?

Worked only with Apache, which used .htaccess:

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteRule ^$ public/     [L]
    RewriteRule (.*) public/$1 [L]
</IfModule>

How to achieve the same result on nginx?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
Z
zevilz, 2018-02-15
@VaniXac

Most likely like this:

location /public/ {
    index index.php;
    try_files $uri $uri/ /public/index.php?$args;
}

If index.php is at the root, then:
location / {
    index index.php;
    try_files $uri $uri/ /index.php?$args;
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question