Yehuda Gutstein
Yehuda Gutstein

Reputation: 381

.htaccess having issue with RedirectMatch

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

Upvotes: 1

Views: 23

Answers (1)

anubhava
anubhava

Reputation: 785471

Your regex is not correct.

Use this:

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

Upvotes: 1

Related Questions