Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/regex/17.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/6/apache/9.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
Regex 301覆盖多个案例的重定向规则_Regex_Apache_.htaccess_Redirect - Fatal编程技术网

Regex 301覆盖多个案例的重定向规则

Regex 301覆盖多个案例的重定向规则,regex,apache,.htaccess,redirect,Regex,Apache,.htaccess,Redirect,是否有任何方法可以使用规则执行以下所有(及类似)重定向 Redirect 301 brand/brand1 http://domain.com/department/brand1 Redirect 301 brand/brand2 http://domain.com/department/brand2 Redirect 301 brand/brand3 http://domain.com/department/brand3 是的,您可以使用RedirectMatch来提供您的正则表达式功能,如

是否有任何方法可以使用规则执行以下所有(及类似)重定向

Redirect 301 brand/brand1 http://domain.com/department/brand1
Redirect 301 brand/brand2 http://domain.com/department/brand2
Redirect 301 brand/brand3 http://domain.com/department/brand3

是的,您可以使用
RedirectMatch
来提供您的正则表达式功能,如下所示:

RedirectMatch 301 brand/([^/]+) http://domain.com/department/$1