The win host implements 301 redirects with Web. config and Httpd.ini

Source: Internet
Author: User

When you are ready to look at this article, you should already know the role and meaning of the 301 redirect, then there is no more explanation.

So the only thing I want to mention is the difference between the domain name band and the non-WWW, and the significance of the 301, details: The difference between the domain name band and the non-www

Here we take the example of redirecting the domain name "qiankoo.com" to "www.qiankoo.com"

How to implement 301 redirection for Windows Virtual Host users:Windows Server 2003 IIS6.0 virtual host under 301 redirect code

The code for the httpd.ini file configuration is as follows, drop location: web site root directory

[Isapi_rewrite] Cacheclockrate 3600 repeatlimit rewritecond Host: ^qiankoo\.com$ rewriterule (. *) http\://www\.qiankoo\.com$1 [I,R]

Note: Remember to replace the domain name with your domain name. If this file already exists (pseudo-static) in the root directory of your website, you can add the above code directly to it.

Urlrewrtie rules under Windows server IIS7.5 virtual host

The web. Config file code is as follows, drop location: web site root directory

<?XML version= "1.0" encoding= "UTF-8"?> <Configuration> <system. WebServer> <rewrite> <rules> <Rulename= "WWW Redirect"stopprocessing= "true"> <MatchURL=".*" /> <conditions> <Addinput= "{http_host}"pattern= "^qiankoo.com$" /> </conditions> <Actiontype= "Redirect"URL= "http://www.qiankoo.com/{r:0}"Redirecttype= "Permanent" /> </Rule> </rules> </rewrite> </system.webserver> </Configuration>

Remember to replace the domain name with your domain name.

Note: After the experiment, this method can only redirect home page, if the whole station 301 jump, need to create a new site in the IIS7 without WWW, arbitrarily designated a directory, set this site 301 jump to take the www can, this online many places have not said Detailed Tutorial: IIS7.5 Full station 301 Jump, Inside page + with parameter URL, this is the real whole station jump two, multi-domain redirection how to write rules? 1. Another line of redirection code is required for the Httpd.ini configuration file.

as follows, redirect the domain name "qiankoo.com", "www.vuln.cn" to "www.qiankoo.com"

[Isapi_rewrite] Cacheclockrate 3600 repeatlimit rewritecond Host: ^qiankoo\.com$ rewriterule (. *) http\://www\.qiankoo\.com$1 [I,R] Re Writecond Host: ^seo.qiankoo\.com$ rewriterule (. *) http\://www\.qiankoo\.com$1 [i,r]

2. In the Web. config configuration file, simply add a vertical bar after the redirected domain name "|" Keep up with the added domain name that needs to be redirected.

As follows

<?XML version= "1.0" encoding= "UTF-8"?> <Configuration> <system. WebServer> <rewrite> <rules> <Rulename= "WWW Redirect"stopprocessing= "true"> <MatchURL=".*" /> <conditions> <Addinput= "{http_host}"pattern= "^qiankoo.com|www.vuln.cn$" /> </conditions> <Actiontype= "Redirect"URL= "http://www.qiankoo.com/{r:0}"Redirecttype= "Permanent" /> </Rule> </rules> </rewrite> </system.webserver> </Configuration> 

Note: Because even after the 301 jump, the search engine for you another with the WWW domain name or there will be a study period, this investigation and the new station slightly different. Weights are generally not lost. So did 301 jump after there will be a period of action, will not take effect immediately!

Original link: http://www.vuln.cn/?p=283

The win host implements 301 redirects with Web. config and Httpd.ini

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.