An issue of rewrite ring redirection When configuring nginx and Wordpress

Source: Internet
Author: User

Today, I am staying at home for another day to build a new Wordpress blog. The server uses nginx.

Because another nginx + Wordpress blog was built before, the previous nginx configuration is used directly, and the following configuration is used:

If ($ host! = 'Www. ABC. me '){

Rewrite ^/(. *) $ http://www.abc.me/#1 permanent;
}

We can see that this is used to redirect ABC. Me To www. ABC. Me.

After this configuration item is addedThe browser reports multiple links and uses chrome to redirect the links before www. ABC. Me and ABC. Me.

 

After finding this problem, I first thought it was a problem with nginx configuration.No related configurations were found except for the above redirection from ABC. Me To www. ABC. Me, and this problem was not found in the previous configuration of another website. Where is the problem?

 

After a long time of hard work, I could not go around, so I had to try to comment out the redirection mentioned above and try again. I found it was okay and I won't redirect it.

The phenomenon becomes like this:

After ABC. Me is opened, www. ABC. Me will not be redirected and the webpage can be opened smoothly.

However, after www. ABC. Me is opened, it will still be transferred to ABC. Me, And the webpage will be OK.

This shows that the redirection from www. ABC. Me To ABC. Me is still working together, although I don't know where it is.

 

I was puzzled, and suddenly a flash of light, this thing will not be related to the site address I set in the WordPress background, a check, it is indeed set ABC. me, this setting will put www. ABC. me to ABC. me?

After you try to change it to www. ABC. Me, you will find that this setting can actually redirect ABC. Me To www. ABC. Me.

This seems to have the same effect as the configuration I wrote in nginx.

I have never thought about this setting in the WordPress background. It's amazing :(

I have to study WordPress'sCodeWhere is it.

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.