.htaccess having issue with RedirectMatch

2019-08-05 03:28发布

I have a site where I need to redirect from one url to another.

The current url: www.somesite.com/people/johndoe/?id=10

The desired url: www.somesite.com/people/?id=10

I am trying this in my .htaccess file but to no avail:

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

This returns:

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

I have looked up many similar questions on this site and elsewhere, but cannot find a solution that works. Thanks in advance

1条回答
干净又极端
2楼-- · 2019-08-05 04:12

Your regex is not correct.

Use this:

RedirectMatch ^/(people)/.+$ /$1
查看更多
登录 后发表回答