WordPress Nginx config
Traditionally, a typical nginx location
block for a WordPress site looks like this...
location {
try_files $uri $uri/ /index.php?$args;
}
However, there is one caveat in it. If $args
doesn't exist, then the question mark is appended to /index.php
for no reason. So, we can use a variable named $is_args
that has the value of "?", only when the arguments are found. So, here's the neat solution / tip...
location {
try_files $uri $uri/ /index.php$is_args$args;
}
Written by Pothi Kalimuthu
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Nginx
Authors
reiaguilera
279.4K
jamesdullaghan
90.14K
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#