How to Implement 301 redirection on a windows Virtual Host

Source: Internet
Author: User
Tags in domain

I bought a space in the host house some time ago. It seems pretty good, but the virtual host is windows. After asking about the space, I said it does not support 301 redirection. The customer service said it could be implemented using a program, finally, the experiment was successful after I found it on the Internet. In fact, the method is very simple. Create a directory, bind the domain name to this directory, and then create a new index in this directory. PHP file, put the 301 redirection ASP or PHP code in the file, so that the domain name bound to this directory is directed to the new domain name defined in your code. I would like to share with you the following. I hope to help some friends who haven't found a solution just like me.

Result: Enter wwbar.com To Go To The http://www.wwbar.com/page.

Note: Sub-directory binding is supported.
1. Bind wwbar.com to your VM in domain name management.
2. Create a folder named 301 under the root directory of the website (you can name the folder by yourself)
3. Open VM management, bind sub-directories, bind Domain Name: wwbar.com bind Directory: 301 (note that 301 is the name of the folder in step 1)
4. Open notepad, create the following text file, save the file as index. php, and upload it to the 301 folder under the root directory.
Reference

<? Php
{
Header ("HTTP/1.1 301 Moved Permanently ");
Header ("Location: http://www.wwbar.com ");
Exit ();
}
?>

Replace the URL in the above document with your url

If your xxx.com has been successfully parsed, enter 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.