Httpd. conf second-level domain name setting method

Source: Internet
Author: User

Add the following content at the end of httpd. conf:

CopyCode The Code is as follows: rewriteengine on
Rewritemap lowercase INT: tolower
Rewritemap vhost TXT:/usr/local/etc/Apache/vhost. Map
Rewritecond $ {lowercase: % {SERVER_NAME} ^ (. +) $
Rewritecond $ {vhost: % 1} ^ (/. *) $
Rewriterule ^/(. *) $ % 1/$1

Here,/usr/local/etc/Apache is the path of your Apache server configuration file, which is changed according to the actual situation.
Then, create a file: vhost. map in the directory of the path.
Content:

Www.domain.com/usr/local/www/data-Dist/Domain
Bbs.domain.com/usr/local/www/data-Dist/BBS
Anyname.domain.com/usr/local/www/data-Dist/anyname
The above sections are in the form of "Domain Name + space + absolute path.

Finally, under your website root directory/usr/local/www/data-Dist, create the corresponding directory:
Domain, BBS, anyname, etc., theoretically unlimited.

In this way, when accessing www.domain.com through a browser, the files in the/usr/local/www/data-Dist/domain directory are actually accessed. Similarly, accessing bbs.domain.com actually accesses files in the/usr/local/www/data-Dist/BBS directory. And you can
Change vhost. MAP at any time to add, delete, and modify your second-level domain name and the actual path to, without restarting Apache

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.