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