【问题标题】:How to configure .htaccess for a subdomain?如何为子域配置 .htaccess?
【发布时间】:2013-09-16 03:04:54
【问题描述】:

我想在子域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>

【问题讨论】:

    标签: php .htaccess subdomain


    【解决方案1】:

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

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

    所以,不,你不能在 .htaccess 中配置虚拟主机,因为它遥不可及

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

    【讨论】:

      猜你喜欢
      • 2018-06-05
      • 1970-01-01
      • 1970-01-01
      • 2016-05-11
      • 1970-01-01
      • 2019-08-31
      • 2017-01-23
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多