Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/.htaccess/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/tensorflow/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
.htaccess htaccess重定向故障_.htaccess_Mod Rewrite_Redirect - Fatal编程技术网

.htaccess htaccess重定向故障

.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。我想摆脱这种情况,因为这对谷歌的推广不是很好 也许任何人都可以帮我,

我使用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
。我想摆脱这种情况,因为这对谷歌的推广不是很好


也许任何人都可以帮我,并提出一个解决方案来重定向这个尴尬的页面?

好吧,这里是你的选择。如您在评论中所说(尽管我觉得有点奇怪),如果您想将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。。。不管它