Apache second-level domain name configuration in windows _ PHP Tutorial-php Tutorial

Source: Internet
Author: User
Tags apache error log
Configuration of apache second-level domain name in windows. Let's summarize the configuration of apache's second-level domain name in windows. next we will use the local 127.0.0.1 for testing. Here we take www.jobs.com as an example, the editor in the following code summarizes the configuration of apache second-level domain names in windows.

Next we will use the local 127.0.0.1 for testing

Here we take www.jobs.com as an example. in the following code, jobs.com can be replaced with the domain name you want. this is just for testing.

Our goal is that different subdomain names can access websites under different directories.:

/;

/;

/News;

1. enable the mod_rewrite function of apache (it must support rewriting). in httpd. conf, just find the # in front of it,

Then, enable the apache virtual host and locate the previous # in httpd. conf.

2. add several domain names. in the C: \ WINDOWS \ system32 \ drivers \ etc directory, find the hosts file notepad to open it and add the following three domain names.

127.0.0.1 www.jobs.com
127.0.0.1 jobs.com
127.0.0.1 news.jobs.com

3. enter the relevant code in the VM to allow it to access the www Directory, find the file in the directory Apache2 \ conf \ extra, and open the code to add the following

 

Then, bind www.jobs.com to the directory where the relevant jobs project is located and add the following code:

 

After the restart, restart apache. If an apache startup error occurs after the restart, view the apache error log and modify the log as needed.

4. create a file in the jobs directory and add the following code to it:


I want to bind news.jobs.com to the new directory, so not only do I need to place the. htaccess file in the root directory,

You also need to place the. htaccess file in the new directory. the. htaccess file in the new directory is written as follows:

RewriteEngine On
RewriteBase/
RewriteCond % {REQUEST_FILENAME }! -F
RewriteCond % {REQUEST_FILENAME }! -D
ErrorDocument 403/404 .htm
ErrorDocument 404/404 .htm

After everything is done, you can try www.jobs.com job.com news.jobs.com and other accesses to see the expected results.

If you need access from other second-level domain names, Repeat steps 2 and 4 in the preceding method. you do not need to restart apache.

This article only applies to the test environment and verifies the security. please use it in the product after everything is set.

For configuration related to apache second-level domain names in windows, use the local 127.0.0.1 for testing. Here we take www.jobs.com as an example. in the following code...

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.