我正在组建一个团队,让我能够有限地访问服务器(长篇故事) . 我的任务是让.htaccess重写子目录中的URL(http://www.myserver.com/subdirectory) . 这应该不是什么大问题,除了规则似乎重写了所有的URL,而不仅仅是那些匹配模式的URL .

RewriteRule ^products/([^/]*)\.html$ products.php?pr_category=$1 [L]
RewriteRule ^products/([^/]*)/([^/]*)\.html$ products.php?pr_category=$1&pr_subcategory=$2 [L]
RewriteRule ^products/([^/]*)/([^/]*)/([^/]*)\.html$ products.php?pr_category=$1&pr_subcategory=$2&pr_name=$3 [L]
RewriteRule ^tech_resource/([^/]*)\.html$ tech_resource.php?tr_category=$1 [L]
RewriteRule ^tech_resource/([^/]*)/([^/]*)\.html$ tech_resource.php?tr_category=$1&tr_name=$2 [L]
RewriteRule ^news/([^/]*)\.html$ news.php?ne_name=$1 [L]

一切似乎都很好,除了 all 的页面URL被重写如下:

http://www.mydomain.com/subdirectory/products/category/subcateogry/images/image.jpg

这就是重写是将$ 1,$ 2和$ 3的内容插入到每个url路径中 . 这些应该只是:

http://www.mydomain.com/subdirectory/images/image.jpg

我错过了什么?它可能是根.htaccess中的东西吗?