Paul Smalling
Paul Smalling

Reputation: 141

Apache .htaccess redirect with query string

I am stuck with apache redirects. I need to redirect https://sitename.com/index.php?q=news to https://sitename.com/news, I use

RewriteEngine on
RewriteCond %{QUERY_STRING} ^q=(.*)$
RewriteRule https://sitename.com/%1? [R=301,L]

But nothing happens

Upvotes: 1

Views: 60

Answers (1)

Abhishek Gurjar
Abhishek Gurjar

Reputation: 7476

Try below rule, I am assuming you have handler for it.

RewriteEngine on
RewriteCond %{QUERY_STRING} ^q=(.*)$
RewriteRule ^ https://sitename.com/%1? [R=301,L]

Upvotes: 2

Related Questions