Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/redis/2.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 wordpress permalink的301重定向_.htaccess_Redirect - Fatal编程技术网

.htaccess wordpress permalink的301重定向

.htaccess wordpress permalink的301重定向,.htaccess,redirect,.htaccess,Redirect,在.httaccess上,我们这样使用 RedirectMatch 301 ^/food/(.*)$ http//:domain.com/food-for-healthy/$1 它工作得很好。但是我们有一个老链接的问题。我们曾经有一个多站点,名称是“食物”。改为“健康食品”。因此,我们的变化如下: RedirectMatch 301 ^/food/(.*)$ http//:domain.com/food-for-healthy/$1 正如你所知,http/:domain.com/food/和

.httaccess
上,我们这样使用

RedirectMatch 301 ^/food/(.*)$ http//:domain.com/food-for-healthy/$1
它工作得很好。但是我们有一个老链接的问题。我们曾经有一个多站点,名称是“食物”。改为“健康食品”。因此,我们的变化如下:

RedirectMatch 301 ^/food/(.*)$ http//:domain.com/food-for-healthy/$1
正如你所知,
http/:domain.com/food/
http/:domain.com/food
是相同的

问题是http/:domain.com/food,它需要转到http/:domain.com/food-for-healty/

我尝试了几种方法,但我的尝试产生了重定向错误

RedirectMatch 301 /food http//:domain.com/food-for-healthy
这会得到一个重定向错误。如何更改它以使其正常工作

我试过这个

RedirectMatch 301 ^/food/?(.*)$ http//:domain.com/food-for-healthy/$1
但是
它带有重定向错误并转到

http:/:domain.com/food-for-healthy/food-for-healthy/food-for-healthy/food-for-h‌​ealthy/food-for-healthy/food-for-healthy/food-for-healthy/food-for-healthy/... 

我看不出为什么需要
RedirectMatch
,因为您正在执行从一个位置到另一个位置的简单重定向,并且没有处理额外的查询字符串值或子页面(如您所说)


你需要准确地了解那些对你有用和不有用的价值观。
http://:
http/:
都不是启动URL的有效方法(其中as
http://
是)。
Redirect permanent /food/ http://domain.com/food-for-healthy/