WordPress Configures the fixed URL method on Linux

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.