The iis7 settings will redirect the domain name without www to the with WWW

Source: Internet
Author: User

After setting up a website in the IIS environment, many friends habitually bind domain names with or without WWW to a website. In this way, although both domain names can be accessed, however, the weight is easily dispersed, resulting in reduced website weight.
In fact, we can automatically jump to a domain name with WWW without access. For example, when we access taotaozaixian.com, the browser automatically jumps to www.taotaozaixian.com. the browser address also displays www.taotaozaixian.com.
To sum up the methods on the internet, two methods are commonly used:
The first is to set website 301 redirection. The advantage is that the configuration is fast and simple; the disadvantage is that you need to create two sites, one real site and one empty site.
The second is to install the URL rewriting tool. The advantage is that you only need to build a real site. The disadvantage is that the configuration is slightly complicated.

The first method can refer to this article https://www.uust.com/wiki/web/86.html

The following uses the actual example to describe the second method.
1. First, resolve taotaozaixian.com www.taotaozaixian.com to the IP address of the same web server.


2. download and install the Web Platform Installer
Https://www.microsoft.com/web/downloads/platform.aspx

3. After the download and installation are complete, find and open Microsoft Web platform installer in the Start Menu.
Enter a URL in the upper-right corner of the Web Platform installer to search
Select "URL rewriting tool 2.0", click Add, and then click Install in the lower right corner

After installing IIS, You can see "URL rewriting ".


4. Configure redirection
Open a website https://www.ssffx.com/htaccess? Jdfwkey = 5 rfiq
Select "www Domain Name Redirection" on the left, and enter the complete domain name www.taotaozaixian.com with WWW in the input box on the right.

Copy the code generated below

<Files ~ "^. (Htaccess | htpasswd) $">
Deny from all
</Files>
Rewriteengine on
Rewritecond % {http_host} ^ (taotaozaixian \. com) (: 80 )? [Nc]
Rewriterule ^ (. *) http://www.taotaozaixian.com/#1 [R = 301, l]
Order deny, allow

 

5. Return to the IIS Site, click "URL rewriting", and click "import rules" on the right"
Paste the rewrite code into the rule and click Apply.


6. Restart the IIS Site. Enter taotaozaixian.com without WWW in the browser, and the browser will automatically jump to www.taotaozaixian.com.

 

The iis7 settings will redirect the domain name without www to the with WWW

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.