Your SEO solution is using non-recommended if
directive inside location
. If Is Evil:
Directive
if
has problems when used inlocation
context, in some cases it doesn’t do what you expect but something completely different instead. In some cases it even segfaults. It’s generally a good idea to avoid it if possible.
The correct way to achieve what I believe you want would be try_files
, e.g.:
location / {
try_files $uri $uri/ @missing;
}
location @missing {
rewrite ^(.*)$ /index.php break;
}