WordPress Set Fixed URL summary
I believe a lot of WordPress users in order to improve the WordPress search engine friendly, or to write the blog address better to remember, will be in the background of WordPress set fixed URL way.
But the problem comes, the first wordpress default URL is the domain name plus p=id way. You change it, you come out. 404 pages
We come to Baidu, do not know the search Ah, the results are as follows
The problem is resolved by locating the LoadModule rewrite_module modules/mod_rewrite.so in the Apache config file httpd.conf and then restarting the server by removing the comment # that precedes it.
Below is the setting under Nginx, add the following code in Nginx's website configuration file
Location/ {if (-f $request _filename/index.html) { rewrite (. *) $1break; if (-F $request _filename/index.php) { rewrite (. *) $1/index.php; } if (-F $request _filename) { rewrite (. *)/index.php; }}
But the nginx on my server has a default WordPress rule file (this file does not guarantee that all nginx can be used, test it yourself)
Wordpress.conf
location/blog/ { try_files $uri $uri//blog/index.php? */wp-/blog/wp-admin$ $scheme://$host $uri/permanent;
Introduce this wordpress.conf in Nginx's Web site configuration file
such as/usr/localhost/nginx/conf/vhost/blog.conf
Blog.conf is my nginx. Web Site configuration file
In this file, add
Include wordpress.conf;
Reboot lnmp is still 404 now.
The problem is, I am using wordpress as the root directory and WordPress rules should be based on the root directory of the/blog folder such as the site configuration path to write
So wordpress.conf should instead
Location/ { try_files $uri $uri//index.php? */wp-/wp-admin$ $scheme://$host $uri/permanent;
Restart Service, problem solving
WordPress Configures the fixed URL method on Linux