Help write the rule. Frontend works well like this:

location / { index index.php; # serve static files directly if (-f $request_filename) { access_log off; expires 30d; break; } ### MAIN REWRITE - This will ignore directories if (!-d $request_filename) { rewrite ^/(.*)$ /index.php$query_string last; } } 

But the admin was able to run only this way:

  rewrite ^/cp/(.*)$ /cp/index.php$query_string last; 

On the front, everything works, and in the admin js, img, css 404, but in the folder they are. Requests in the admin of this nature /cp/faq/list/0.htm

    1 answer 1

    Such a problem is solved by the try_files directive, but not by rewrite.

     location / { root /var/site; try_files $uri$is_args$args $uri $uri/index.html index.php$is_args$args; } location /admin/ { root /var/site/cp; try_files $uri$is_args$args $uri $uri/index.html index.php$is_args$args; } location ~ \.php { fastcgi_pass localhost:8000; ... }