Reputation: 3
So I am having issue I want all requests from
https://transfinmedia.com/author?url=akchopra1-A268
to be 301 redirected on
https://transfinmedia.com/author/akchopra1-A268
but when i use
RewriteEngine on
RewriteCond %{QUERY_STRING} url=(.*)
RewriteRule ^author(.*) /author/%1 [L,R=301,NC]
requests to
https://transfinmedia.com/author?url=akchopra1-A268 gets redirected on
https://transfinmedia.com/author/akchopra1-A268?url=akchopra1-A268
what am i doing wrong here, completely out of clue.
Upvotes: 0
Views: 23
Reputation: 41219
By default ,mod-rewrite appends old QueryString
to the new target url. To discard QueryString ,you need to put a ?
(an empty question mark) at the end of the target url.
RewriteEngine on
RewriteCond %{QUERY_STRING} url=(.*)
RewriteRule ^author(.*) /author/%1? [L,R=301,NC]
Make sure to clear your browser cache before using this.
Upvotes: 1