M
M
mrSaizer2021-06-24 22:30:29
htaccess
mrSaizer, 2021-06-24 22:30:29

How to set up a redirect for similar URLs?

Good afternoon!
There is a pool of format urls

domain.com/catalog/page/xx-xx

Where in /xx-xx, instead of x - any literal Latin characters

I need to create redirect such URLs to an analogue of the page, but without these /xx-xx (and also without a slash at the end). Redirect - 301

Example
domain.com/catalog/page/ab-cd ---301--> domain.com/catalog/page


How can I implement this? Preferably via .htaccess

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
dodo512, 2021-06-24
@dodo512

RewriteEngine on

RewriteRule ^(.+)/[a-z]{2}-[a-z]{2}$ /$1 [R=301,L]

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question