如何为子域配置 .htaccess


How to configure .htaccess for a subdomain?

我想显示子域test.mysite.com上的页面,我在这个子域上有几个文件夹,所以如果有人去test.mysite.com/siteone它会向您显示该文件夹中的站点。

如何配置 .htaccess 文件?我有以下代码,我在某些问题中找到了它,但它不起作用:

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ /index.php?url=$1 [QSA,L]
</IfModule>

".htaccess 文件提供了一种基于每个目录进行配置更改的方法 http://httpd.apache.org/docs/2.2/howto/htaccess.html。

当用户在浏览器中触发请求时,它会一直向下移动: 1 台服务器计算机 2 阿帕奇服务 3 (v)主机配置(通过 http.conf,预加载到 Apache 服务中) 4 目录配置(按需加载)

所以,不,你不能在.htaccess中配置vhosts,因为它是遥不可及的

如果您有权访问 http.conf 或后续包含文件,只需查看http://httpd.apache.org/docs/current/vhosts/examples.html