【发布时间】:2025-12-14 17:55:01
【问题描述】:
我的网站的主域和子域存在 htaccess 重写问题,
我的问题是,www.example.com 下有 htaccess 代码,
RewriteBase /
Options +FollowSymLinks
RewriteEngine On
RewriteRule ^([^?]*).html$ content.php?pid=$1
当我使用 URL 路径 www.example.com/test.html 或 www.example.com/folder/test.html 创建内容页面时,它工作得非常好。
但我的子域上有相同的代码,并且“文件夹”网址不起作用。我的意思是 subdomain.example.com/test.html 工作正常,但 subdomain.example.com/folder/test.html 似乎不起作用。
提前非常感谢.. :) 请帮助...
【问题讨论】:
-
您必须首先知道如何在您的 vhosts 配置文件中为子域定义 VirtualDocumentRoot。
-
But i have same code on my subdomain请在这里发帖。 -
是的 anubhava,我已经在子域的 htaccess 代码中也有了该代码.. 但它不起作用
-
你能把子域的htaccess代码贴在这里吗?
-
你好anubhava,除了文件名不同,代码与上面相同,RewriteBase / Options +FollowSymLinks RewriteEngine On RewriteRule ^([^?]*).html$ subdomaincontent.php?pid=$1
标签: php .htaccess mod-rewrite url-rewriting