如何使用.htaccess权限在子域中部署PHP web应用程序

如何使用.htaccess权限在子域中部署PHP web应用程序,php,apache,.htaccess,permissions,subdomain,Php,Apache,.htaccess,Permissions,Subdomain,我已经在我的主机(我主机的根目录)上部署了一个PHP web应用程序,现在我想在名为“stat”的文件夹中安装一个web分析PHP web应用程序(在我主机的根目录中作为子域),但是第一个PHP应用程序根目录中的“.htaccess”文件不允许访问“stat”文件夹。我如何配置“.htaccess”允许将map stat.mydomain.com映射到“stat”文件夹的文件 这是位于我的主机根目录中的“.htaccess”文件: DirectoryIndex index.php <IfM

我已经在我的主机(我主机的根目录)上部署了一个PHP web应用程序,现在我想在名为“stat”的文件夹中安装一个web分析PHP web应用程序(在我主机的根目录中作为子域),但是第一个PHP应用程序根目录中的“.htaccess”文件不允许访问“stat”文件夹。我如何配置“.htaccess”允许将map stat.mydomain.com映射到“stat”文件夹的文件

这是位于我的主机根目录中的“.htaccess”文件:

DirectoryIndex index.php
<IfModule mod_rewrite.c>
RewriteEngine On
#RewriteBase /
RewriteCond %{REQUEST_URI} ^(.*)//(.*)$
RewriteRule . %1/%2 [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^.*$ index.php?qa-rewrite=$0&%{QUERY_STRING} [L]
</IfModule>
DirectoryIndex.php
重新启动发动机
#重写基/
RewriteCond%{REQUEST_URI}^(.*)/(.*)$
重写规则%1/%2[R=301,L]
重写cond%{REQUEST_FILENAME}-F
重写cond%{REQUEST_FILENAME}-D
RewriteRule^.*$index.php?qa rewrite=$0&%{QUERY_STRING}[L]
我希望我能清楚地描述我的问题。请尽快帮助我


提前感谢。

首先,我希望您的
httpd.conf
子域
stat.mydomain.com
中有一个
VirtualHost
条目,正如
faa
所评论的那样

完成该工作后,使用以下命令更改
$DOCUMENT\u ROOT/.htaccess

DirectoryIndex index.php
Options +FollowSymLinks -MultiViews
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php?qa-rewrite=$0 [L,QSA]
</IfModule>
DirectoryIndex.php
选项+以下符号链接-多视图
重新启动发动机
重写基/
重写cond%{REQUEST_FILENAME}-F
重写cond%{REQUEST_FILENAME}-D
重写规则。php?qa rewrite=$0[L,QSA]

类似的内容可能是:
重写规则^/(子域)/(.*)$http://subdomain.domain.com/$1[R=301,L]
?不太确定你在找什么。基本上就是说请求
http://subdomain.domain.com/
将从
http://domain.com/subdomain/
。如果我理解正确,该文件夹是在
httpd.conf
中的虚拟主机条目中定义的,而不是在.htaccess中定义的。例如:
ServerName stat.domain.com
,其中
/home/httpd/htdocs/
是主域的文档根。