The website is structured to have the main language (fi
) in the root folder and other language versions in subfolders. The site consists of static HTML files in real folders, not virtual. Here I have on the first line a rule which works, and redirects all traffic that target those three folders. However, the 2nd line does not do what I want.
RedirectMatch permanent "(se|pl|en)/(.+)?" https://www.example.com/example
RedirectMatch permanent "(!lv|!ee)/?(.+)?" https://www.example.com/another-example
- So, root directory needs to be redirected to url
A
- Subfolders
se
,pl
anden
need to be redirected to urlB
- Subfolders
lv
andee
must be ignored.
2
Answers
I got to work by forgetting
RedirectMatch
and usingRewriteCond
+RewriteRule
instead.Applied from anubhava's answer to this question: https://stackoverflow.com/a/21761345/1383913
If I understood it correctly, you can use these rules with regex anchors:
Make sure to clear your browser cache before testing these changes.