yarek
yarek

Reputation: 12044

.htaccess How to create a RedirectPermanent by triming a char?

My goal is to create a permanent redirect

http://example.com/category-/list/town/id/id2/country

to http://example.com/category/list/town/id/id2/country

(removing the last '-' char (if present) from category

regards

Upvotes: 0

Views: 44

Answers (1)

anubhava
anubhava

Reputation: 785058

You can use this rule in your root .htaccess:

RedirectMatch 301 ^/(.*?)-/(.*)$ /$1/$2

Upvotes: 1

Related Questions