Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/apache/8.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文件中使用regexp重定向301_Regex_Apache_.htaccess - Fatal编程技术网

在.htaccess文件中使用regexp重定向301

在.htaccess文件中使用regexp重定向301,regex,apache,.htaccess,Regex,Apache,.htaccess,我正在寻找一个正则表达式来重定向URL,如: example.net/example-1 example.net/example-2 example.net/example-3 我有许多URL具有相同的前缀,但在示例-之后有不同的后缀 我在试着用regex Redirect 301 /example-.*$ http://example.net/example-overview Redirect 301 /example-(.*)? http://example.net/example-ove

我正在寻找一个正则表达式来重定向URL,如:

example.net/example-1
example.net/example-2
example.net/example-3
我有许多URL具有相同的前缀,但在
示例-
之后有不同的后缀

我在试着用regex

Redirect 301 /example-.*$ http://example.net/example-overview
Redirect 301 /example-(.*)? http://example.net/example-overview
Redirect 301 /example-(.+)[/]?$ http://example.net/example-overview
Redirect 301 /([^/example-]+) http://example.net/example-overview
我无法让它工作。
正常重定向(例如
example-1
example overview
正常工作

编辑: 找到解决方案:

RedirectMatch 301 ^/example-(.+)[/]?$ http://example.net/example-overview
不支持正则表达式,请使用