简体   繁体   English

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

[英]How can i deploy a PHP web application in subdomain using .htaccess permission

I have deployed a PHP web application on my host (root of my host) now i want to install a web analytic php web application in a folder called "stat" (in the root of my host as a sub domain) but ".htaccess" file in the root of first PHP application does not allow to access "stat" folder how can i config ".htaccess" file to allow map stat.mydomain.com to "stat" folder. 我已经在主机(主机的根)上部署了一个PHP Web应用程序,现在我想在名为“ stat”的文件夹(在主机的根目录中作为子域)中安装一个Web分析php Web应用程序,但是将“ .htaccess”第一个PHP应用程序根目录中的“”文件不允许访问“ stat”文件夹,我如何配置“ .htaccess”文件以允许将stat.mydomain.com映射到“ stat”文件夹。

This is ".htaccess" file located in the root of my host: 这是位于主机根目录中的“ .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>

I wish i can describe my problem clearly. 我希望我能清楚地描述我的问题。 please help me as soon as possible. 请尽快帮助我。

Thanks in advance. 提前致谢。

First thing first I hope you have a VirtualHost entry in your httpd.conf for subdomain stat.mydomain.com as commented by faa . 首先,我希望您在httpd.conf有一个属于subdomain stat.mydomain.comVirtualHost条目,如faa所评论。

Once you have that working change your $DOCUMENT_ROOT/.htaccess with this: 完成该工作后,请使用以下命令更改$DOCUMENT_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>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM