我对你有挑战。
考虑这些网址:
http://mydomain.com/Obj
http://mydomain.com/Obj/index.php
http://mydomain.com/Obj/Mainv2/url.php
http://mydomain.com/Obj/Main/Bids/index.php
RewriteRule ^Obj/$ Obj/Masterpage/Backoffice.php?Folder=&Page=index.php [NC,S=2,QSA]
RewriteRule ^Obj/(.*)/(.*)/(.*).php$ Obj/Masterpage/$1.php?Folder=$2&Page=$3.php [NC,QSA]
RewriteRule ^Obj/(.*)/(.*).php$ Obj/Masterpage/Backoffice.php?Folder=&Page=$2.php [NC,QSA]
现在所有网址都应该与htaccess一起使用,但我无法使用/Obj/Mainv2/url.php和/Obj/Main/Bids/index.php。这两个中只有一个正在工作。
所以回顾一下:
http://mydomain/Obj should result in http://mydomain.com/Masterpage/Backoffice.php?Folder=&Page=index.php
http://mydomain.com/Obj/index.php should also result in http://mydomain.com/Masterpage/Backoffice.php?Folder=&Page=index.php
http://mydomain.com/Obj/Mainv2/url.php should result in http://mydomain.com/Obj/Masterpage/Backoffice.php?Folder=&Page=url.php
http://mydomain.com/Obj/Main/Bids/index.php should result in http://mydomain.com/Obj/Masterpage/Main.php?Folder=Bids&Page=index.php
答案 0 :(得分:0)
我看到了问题,但我不知道如何解决它。
问题在于您的第2条规则被重写并被第3条规则捕获并且将被重新规划。
所以Obj/Main/Bids/index.php
导致Obj/Masterpage/Main.php?Folder=Bids&Page=index.php
,但这也将通过htaccess文件,它会将其重写为Obj/Masterpage/Backoffice.php?Folder=&Page=index.php
,因为它有匹配。