I am trying to do 301 redirect from the below URL
www.example.com/categories/Writing-Translation
to
www.example.com/categories/Writing-Translation-jobs
However, it is always redirecting a page with the following url
www.example.com/categories/categories/Writing-Translation-jobs?cid=Writing-Translation
This is the htaccess code used for redirection
301 Redirect
RewriteCond %{QUERY_STRING} ^cid=Writing-Translation$ [NC]
RewriteRule ^categories/Writing-Translation$ https://www.example.com/categories/Writing-Translation-jobs [R=301,NE,NC,L]
2
Answers
It worked with the following rule by adding "/?" in the beginning:
You may use this rule as your topmost rule:
?
at the end of target URI will strip off existing query string. Make sure to test it in a new browser.