need
The virtual host does not have as many games as the server, and there is no way to modify some configurations through the command line and other methods. Basically, there is only one control panel to configure basic things. If you want to resolve multiple domain names to this virtual host, so that each secondary directory becomes the root directory of the current domain name, you can actually do it.
step
1. Resolve the domain name normally to ensure that the domain name can access the root directory normally
2. Create a .htaccess
file in the virtual host root directory
.htaccess file rules
The .htaccess file is the configuration file of the Apache host, and we can implement some forwarding rules through this file. Copy the following rule directly into the .htaccess file and save it.
This rule is to bind weixin.qq.com to the weixin directory under the secondary directory
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
# 绑定weixin.qq.com到二级目录weixin
RewriteCond %{HTTP_HOST} ^weixin\.qq\.com$ [NC]
RewriteCond %{REQUEST_URI} !^/weixin/
RewriteRule ^(.*)$ weixin/$1?Rewrite [L,QSA]
</IfModule>
If you want to bind multiple domain names, just copy a layer of configuration, for example:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
# 绑定weixin.qq.com到二级目录weixin
RewriteCond %{HTTP_HOST} ^weixin\.qq\.com$ [NC]
RewriteCond %{REQUEST_URI} !^/weixin/
RewriteRule ^(.*)$ weixin/$1?Rewrite [L,QSA]
# 绑定tieba.baidu.com到二级目录tieba
RewriteCond %{HTTP_HOST} ^tieba\.baidu\.com$ [NC]
RewriteCond %{REQUEST_URI} !^/tieba/
RewriteRule ^(.*)$ tieba/$1?Rewrite [L,QSA]
# 绑定www.taobao.com到二级目录taobao
RewriteCond %{HTTP_HOST} ^www\.taobao\.com$ [NC]
RewriteCond %{REQUEST_URI} !^/taobao/
RewriteRule ^(.*)$ taobao/$1?Rewrite [L,QSA]
</IfModule>
author
TANKING
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。