Today, we summarize the configuration of the two-level domain name under Windows Apache.
< span="">
The following is a test using a local 127.0.0.1
Here we take www.jobs.com as an example, the following code in the jobs.com can be replaced by your own desired domain name here just for testing.
Our goal is that different subdomains can access sites in different directories:
/ ;
/ ;
/news;
1, open the Apache mod_rewrite function (It is sure to let it support rewrite) in httpd.conf found < span=""> The front of the # number to go on the line,
Then open Apache virtual Host in httpd.conf found < span=""> The front of the # number.
2, add a few domain names, found in the C:\WINDOWS\SYSTEM32\DRIVERS\ETC directory hosts this file Notepad open it, 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, in the virtual host to fill in the relevant code so that it has access to the WWW directory, < span=""> Locate the file in the Apache2\conf\extra directory and open the code to add the following
< span="">< span="">< span="">< span="">< span="">< span="">< span="">< span="">< span="">< span="">< span="">< span="">
Then bind the www.jobs.com to the relevant jobs project in the directory code add the following
< span="">< span="">< span="">< span="">< span="">< span="">< span="">< span="">< span="">< span="">< span="">< span="">
After you are done, then restart Apache, if you encounter an Apache boot error after restarting, check the Apache bug log and modify it as required.
4. Create < span=""> < span=""> a file in the jobs directory to add the following code
I'm bound to bind the news.jobs.com to the new directory, so not only to place it in the root directory . htaccess files,
Also place the. htaccess file in the new directory, and the. htaccess in the new directory 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 so on, and see what you're looking for.
If you need another level two domain name access, follow the above method to repeat 2, 4 steps on it, do not need to restart Apache
This article involves only for testing the environment and for verifying security, so use it in your product after everything is set up.
http://www.bkjia.com/PHPjc/440361.html www.bkjia.com true http://www.bkjia.com/PHPjc/440361.html techarticle Small series today to summarize under the Windows Apache two-level domain name of the relevant configuration under the use of local 127.0.0.1 test we here to www.jobs.com for example, the following code in the ...