Amuk Saxena February 2016

htaccess: Rewrite second part of url having "view_retailer" to "view-retailer"

I am trying to change url from


Here is my rules, and these rules are not working.

RewriteEngine On
RewriteRule ^view-retailer/(.*)$ /view_retailer/$1 [R=302,NE,L]

There are many urls which are having "view_retailer" in common, and I want to rename them to "view-retailer". Can anyone please help me out to rename the url from to

I have tried to re-write url in, please have a look on the following image

enter image description here

What am I doing wrong? Please let me know the answer.

Thanks in advance


Amuk Saxena February 2016

Finally I got the solution to my question.

RewriteEngine On
RewriteRule ^view_retailer/(.*)/$ /view-retailer/(.*)/ [L]


RewriteRule view_retailer/(.*)$1 [R=301,L,QSA]

Here is the following code tested and running on

enter image description here

Post Status

Asked in February 2016
Viewed 1,182 times
Voted 7
Answered 1 times


Leave an answer