Difference between revisions of "Nginx wordpress rewrite"
From KOP KB
(Created blank page) |
|||
(One intermediate revision by the same user not shown) | |||
Line 1: | Line 1: | ||
+ | First example here is for the main root directory | ||
+ | <syntaxhighlight lang="nginx"> | ||
+ | location / { | ||
+ | try_files $uri $uri/ /index.php$is_args$args; | ||
+ | } | ||
+ | </syntaxhighlight> | ||
+ | This example is for sites that are in subfolders from the web root of the domain. | ||
+ | <syntaxhighlight lang="nginx"> | ||
+ | location /path/to/wordpress/ { | ||
+ | try_files $uri $uri/ /path/to/wordpress/index.php$is_args$args; | ||
+ | } | ||
+ | </syntaxhighlight> | ||
+ | I have found so far this works for other applications like wordpress that depend on an index.php rewrite for their clean or "nice looking" urls. |
Latest revision as of 22:07, 10 August 2017
First example here is for the main root directory
location / {
try_files $uri $uri/ /index.php$is_args$args;
}
This example is for sites that are in subfolders from the web root of the domain.
location /path/to/wordpress/ {
try_files $uri $uri/ /path/to/wordpress/index.php$is_args$args;
}
I have found so far this works for other applications like wordpress that depend on an index.php rewrite for their clean or "nice looking" urls.