问题描述
这似乎是一个愚蠢的问题,但我不明白。
This may seem like a silly question but I can't figure it out.
让我们说我有一个不同的文件夹如的public_html文件夹:信天翁,乌鸦,乌鸦和常见问题解答
let's say I have a public_html folder with various folders like: Albatross, Blackbirds, Crows and Faqs.
我希望把它使任何流量信天翁/ faqs.php,黑鸟/ faqs.php,乌鸦/ faqs.php等会看到是常见问题解答/ faqs.php文件?鸟=信天翁和常见问题解答/ faqs.php?鸟=乌鸦或者你有什么。
I want to make it so that any traffic to Albatross/faqs.php, Blackbirds/faqs.php, Crows/faqs.php etc will see the file that is at faqs/faqs.php?bird=albatross or faqs/faqs.php?bird=crows or what have you.
如果我进入信天翁文件夹的.htaccess文件我能做到这一点。
If I go into the Albatross folder's .htaccess file I can do this
RewriteRule faqs.php$ /faqs/faqs.php?cat=albatross[QSA]
,工作正常,但我想提出一些在顶层.htacces这适用于所有的人,这样的尝试:
Which works fine, but I want to put something in the top level .htacces that works for all of them, so tried:
RewriteRule faqs.php$ /faqs/faqs.php?cat=albatross[QSA]
RewriteRule /(.*)/faqs.php$ /faqs/faqs.php?cat=$1 [QSA]
甚至
RewriteRule /albatross/faqs.php$ /faqs/faqs.php?cat=albatross [QSA]
和各种人,但似乎没有任何工作,当我去 HTTP://www.birdsandwhatnot .COM /信天翁/ faqs.php 我看到相同的文件相同的方式,它一直都是。是否与越往上.htaccess文件的子文件夹冲突的.htaccess文件的presence?
and various others but nothing seems to work, when I go to http://www.birdsandwhatnot.com/albatross/faqs.php I see the same file the same way it's always been. Does the presence of an .htaccess file in the subfolder conflict with the higher up .htaccess file?
我缺少的东西?
推荐答案
一个小幅盘整应该做的伎俩
A small correction should do the trick
RewriteEngine on
RewriteRule ^(.*)/faqs.php$ /faqs/faqs.php?cat=$1 [QSA]
/不被传递给分析器。
"/" is not being passed to parser.
希望它可以帮助
这篇关于重写的子文件夹规则的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!