Maniac
Maniac

Reputation: 237

Redirect if match two conditions

I'm looking for a solution to this case via htaccess - If it finds an address with the following structure: https://www.example.com/(en|ro|ru and etc.)/page.html

To redirect them to the same address without en, ro or ru and without .html .

Any suggestions?

Thanks in advance!

Upvotes: 0

Views: 59

Answers (1)

ALFA
ALFA

Reputation: 1744

RewriteEngine On
RewriteRule (?:en|es)\/(.*)(.*\.html) /$1 [R=301,L]

You can test the result here and check the regex explanation here.

Upvotes: 1

Related Questions