The other day I was interested in how requests are redirected to Drupal and others.
So, the Apache type construction
RewriteCond% {REQUEST_FILENAME}! -F
RewriteCond% {REQUEST_FILENAME}! -D
RewriteRule ^ (. *) $ Index.php? Q = $ 1 [L, QSA]
')
need to redo not in
location / {
if (! $ request_file) {
rewrite ^ (. *) /index.php?q=$1 last;
}
}
location = /index.php {
fastcgi ...
}
and not even in
location / {
error_page 404 = /index.php?q=$request_uri;
}
location = /index.php {
fastcgi ...
}
but in this:
location / {
error_page 404 = drupal ;
}
location = drupal {
fastcgi_param SCRIPT_FILENAME /path/to/index.php;
fastcgi_param QUERY_STRING q = $ request_uri;
fastcgi ...
}
Source: https://habr.com/ru/post/46500/
All Articles