目录的.htaccess rewriterule似乎不仅适用于子域

时间:2013-10-26 14:40:31

标签: php .htaccess mod-rewrite url-rewriting

我的网站有主域名&具有htaccess重写问题的子域名,

我的问题是,www.example.com下有htaccess代码,

RewriteBase / 
Options +FollowSymLinks 
RewriteEngine On
RewriteRule ^([^?]*).html$ content.php?pid=$1

当我使用网址路径www.example.com/test.html或www.example.com/folder/test.html创建内容页面时,它的效果非常好。

但是我的子域名和代码上有相同的代码。 '文件夹'网址不起作用。我的意思是subdomain.example.com/test.html工作正常,但subdomain.example.com/folder/test.html似乎不起作用。

提前多多感谢.. :)请帮忙...

1 个答案:

答案 0 :(得分:0)

您可以在您的子域.htaccess:

中尝试此代码
Options +FollowSymLinks -MultiViews

RewriteEngine On
RewriteBase /subdomain/

RewriteRule ^([^.]+)\.html$ subdomaincontent.php?pid=$1 [L,NC,QSA]

确保.htaccess以下没有其他subdomain

相关问题