Amuk Saxena February 2016

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

I am trying to change url from

http://www.dev.example.in/view_retailer/ebay-in

to

http://www.dev.example.in/view-retailer/ebay-in

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 http://www.dev.example.in/view_retailer/ebay-in to http://www.dev.example.in/view-retailer/ebay-in

I have tried to re-write url in http://htaccess.mwl.be/, 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

Answers


Amuk Saxena February 2016

Finally I got the solution to my question.

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

or

RewriteRule view_retailer/(.*) http://www.example.in/view-retailer/$1 [R=301,L,QSA]

Here is the following code tested and running on http://htaccess.mwl.be/

enter image description here

Post Status

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

Search




Leave an answer