Wordpress configures the fixed url Method on linux, wordpressurl
Wordpress fixed url setting Summary
I believe that many wordpress users will set a fixed url in the background of wordpress to improve wordpress's friendliness to search engines, or to write a blog address that is easier to remember.
But the question is, is the default wordpress url added with a domain name at first? P = id. After modification, the 404 page is displayed.
Let's get a hundred times. If you don't know, search. The result is as follows:
Find LoadModule rewrite_module modules/mod_rewrite.so in the Apache configuration file httpd. conf, remove the comment # above, and restart the server. The problem is solved.
Next let's talk about the settings under nginx. Add the following code to the nginx website configuration file.
location / {if (-f $request_filename/index.html){ rewrite (.*) $1/index.html break; }if (-f $request_filename/index.php){ rewrite (.*) $1/index.php; }if (!-f $request_filename){ rewrite (.*) /index.php; }}
However, nginx on my server has a default wordpress rule file (this file cannot be used in all nginx files. Test it by yourself)
Wordpress. conf
location /blog/ { try_files $uri $uri/ /blog/index.php?$args;}# Add trailing slash to */wp-admin requests.rewrite /blog/wp-admin$ $scheme://$host$uri/ permanent;
Introduce this wordpress. conf in the nginx website configuration file
For example,/usr/local/nginx/conf/vhost/blog. conf
Blog. conf is the website configuration file on nginx.
Add this file
include wordpress.conf;
Restart lnmp. It's still 404
The problem is that I use wordpress as the root directory, and wordpress rules should be written according to the website configuration path such as/blog folder under the root directory.
So the wordpress. conf should be changed
location / { try_files $uri $uri/ /index.php?$args;}# Add trailing slash to */wp-admin requests.rewrite /wp-admin$ $scheme://$host$uri/ permanent;
Restart the service and solve the problem.