Quantcast
Channel: nginx won't execute PHP code when redirected from a SEO like URL - Server Fault
Viewing all articles
Browse latest Browse all 4

Answer by Esa Jokinen for nginx won't execute PHP code when redirected from a SEO like URL

$
0
0

Your SEO solution is using non-recommended if directive inside location. If Is Evil:

Directive if has problems when used in location 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;
}

Viewing all articles
Browse latest Browse all 4

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>