[英]Simple HTACCESS Rule Rewrite wont work
RewriteRule ^shop _new_shopAll.php [NC]
RewriteRule ^shop/new _new_shopNew.php [NC]
RewriteRule ^shop/swarovski _new_shopSwar.php [NC]
RewriteRule ^shop/signature _new_shopSig.php [NC]
RewriteRule ^shop/wedding _new_shopWedding.php [NC]
RewriteRule ^shop/celeb _new_shopCeleb.php [NC]
RewriteRule ^shop/sale _new_shopSale.php [NC]
RewriteRule ^shop/sw3 _new_shopSW3.php [NC]
I do not seem to realise why shop just works and everything else works with the same? 我似乎不明白为什么购物只能正常工作,而其他一切都可以正常工作吗? Do $ or $1 need to be added? 是否需要添加$或$ 1?
I want this to work 我想要这个工作
/shop?filter=Black = /_new_shopAll.php?filter=Black
/shop/celeb?filter=Black = /_new_shopCeleb.php?filter=Black
/shop = /_new_shopAll.php
/shop/celeb = /_new_shopCeleb.php
Those are separate links. 这些是单独的链接。
Your first rule RewriteRule ^shop _new_shopAll.php [NC]
will also match shop/new
and replace the link before any of the other rewrites have a chance to touch the link. 您的第一个规则RewriteRule ^shop _new_shopAll.php [NC]
也将匹配shop/new
并在其他任何重写都没有机会触摸链接之前替换该链接。 All the RewriteRules afterwards instead see _new_shopAll.php
. 之后所有的RewriteRules都将看到_new_shopAll.php
。
You need to add a $
to the end of the first rule like so: RewriteRule ^shop/?$ _new_shopAll.php [NC]
That way it won't match shop/new
and the other rules will have a chance to match it. 您需要在第一个规则的末尾添加一个$
,如下所示: RewriteRule ^shop/?$ _new_shopAll.php [NC]
这样,它就不会与shop/new
匹配,其他规则将有机会匹配它。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.