.htaccess htaccess重定向故障
我使用mod rewrite并执行以下操作:.htaccess htaccess重定向故障,.htaccess,mod-rewrite,redirect,.htaccess,Mod Rewrite,Redirect,我使用mod rewrite并执行以下操作: RewriteRule ^brand/([A-Za-z0-9-]+)/([A-Za-z0-9-\.\_]+)/?$ model.php?ref=$2&brand=$1 [NC] 而且效果很好!但我有一个问题:当你通过url时 brand/stuff/ffgfg.php它将重定向到一个页面brand/stuff/ffgfg?ref=ffgfg.php&brand=stuff。我想摆脱这种情况,因为这对谷歌的推广不是很好 也许任何人都可以帮我,
RewriteRule ^brand/([A-Za-z0-9-]+)/([A-Za-z0-9-\.\_]+)/?$ model.php?ref=$2&brand=$1 [NC]
而且效果很好!但我有一个问题:当你通过url时
brand/stuff/ffgfg.php
它将重定向到一个页面brand/stuff/ffgfg?ref=ffgfg.php&brand=stuff
。我想摆脱这种情况,因为这对谷歌的推广不是很好
也许任何人都可以帮我,并提出一个解决方案来重定向这个尴尬的页面?好吧,这里是你的选择。如您在评论中所说(尽管我觉得有点奇怪),如果您想将brand/stuff/ffgfg.php重定向到brand/stuff/ffgfg,您可以使用
RewriteRule ^brand/([A-Za-z0-9-]+)/([A-Za-z0-9-\.\_]+).php/?$ brand/$1/$2 [NC]
显然,如果你想重定向到brand/stuff/ffgfg?ref=ffgfg&brand=stuff,你可以使用
RewriteRule ^brand/([A-Za-z0-9-]+)/([A-Za-z0-9-\.\_]+).php/?$ model.php?ref=$2&brand=$1 [NC]
你想要实现什么还不清楚。如果调用brand/stuff/ffgfg.php,它将重定向到model.php?ref=ffgfg.php&brand=stuff,这是应该的。让我们知道你想要发生什么。我希望它重定向到brand/stuff/ffgfgdoes nothing。。。不管它