Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/url/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与重定向匹配有问题_.htaccess_Url_Redirect - Fatal编程技术网

.htaccess与重定向匹配有问题

.htaccess与重定向匹配有问题,.htaccess,url,redirect,.htaccess,Url,Redirect,我有一个网站,我需要从一个url重定向到另一个 当前url:www.somesite.com/people/johndoe/?id=10 所需的url:www.somesite.com/people/?id=10 我正在.htaccess文件中尝试此操作,但无效: RedirectMatch^/people/(.*)$/people/?id=$1 这将返回: www.somesite.com/people/?id=johndoe 我在这个网站和其他地方查找了许多类似的问题,但找不到有效的解决方

我有一个网站,我需要从一个url重定向到另一个

当前url:
www.somesite.com/people/johndoe/?id=10

所需的url:
www.somesite.com/people/?id=10

我正在.htaccess文件中尝试此操作,但无效:

RedirectMatch^/people/(.*)$/people/?id=$1

这将返回:

www.somesite.com/people/?id=johndoe

我在这个网站和其他地方查找了许多类似的问题,但找不到有效的解决方案。提前感谢

您的正则表达式不正确

使用以下命令:

RedirectMatch ^/(people)/.+$ /$1

这是可行的,但显然我误解了我任务的要求。你能聊一分钟吗?这样我就可以尝试在评论或新问题之外解决这个问题了?显然,出于SEO原因,我需要让原始url仍然出现,但实际页面应该调用的是你制定的修改后的url。