Windows modifies the local Hosts file

Source: Internet
Author: User

In the use of some of the following PHP integrated development tools (such as Phpstudy wampserver, etc.)

Sometimes there is a need: I don't want to visit my localhost/xxx/xxx/xxx.php in such a way

What about the file? It's too much trouble to write!

How to solve such a problem?

Very simple, take phpstudy as an example (Wampserver similar)

Let's start with a new test file in the WWW directory (for convenience, write a phpinfo bar):

Normal we want to access this file is this:

The writing is still quite a lot.

What do you want to do with domain access? For example: through Test.info

Other Options menu, site domain name management

Fill in the website domain name (ex: Test.info)

Select the Site directory (point to the test folder that we just created in the WWW directory)

Then select the "New" button

Finally save the settings and build the configuration file

Is it possible to use this domain name for access now?

Let's try it!

It doesn't look good! Why is it? Because the local Hosts file (the local DNS resolution table, the server is also some, generally we visit the domain name will go to the DNS server to find the corresponding IP will be able to access the site we want to go! ) has not been modified. Let's modify this file:

The path under win:

Open the Hosts file as an administrator (not sure to make a backup first)

Add a corresponding relationship on the last line

127.0.0.1 Test.info

Save it, let's try it again! Did you open it normally?

Later we create a new PHP file access format under the Test folder is: test.info/xxx.php

The advantage is that some of the interfaces that restrict IP are not allowed to be accessed. Of course, also to try and

The formal environment remains consistent. It's a good habit. Let's form together!

(Avatar from micro-blog-Self-study illustration half a year) next goodbye!

Windows modifies the local Hosts file

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.