A
A
Anton2020-02-20 22:37:39
htaccess
Anton, 2020-02-20 22:37:39

Htaccess rewrite subdirectories?

All Internal Combustion Engine.

First, I will describe the essence of the problem that needs to be solved in order to understand what and why, and then the question itself, the moment on which I got stuck.

Essence:
According to its idea, the functionality is similar to the implementation of language versions of the site in subdirectories.
site.ru
site.ru/en
site.ru/fr etc.
On this analogy, I will present the general picture.
Accordingly, each subdirectory represents its own version of the original site, as if this site were a physical copy of the original in the subdirectory.
Naturally, there can be no talk about this, and also, these directories do not physically exist on the server, in the system either. Formally speaking, they are only a "label". In the case of similar functionality and a subdomain, everything is simpler, but here it is different.

The following is required because
xtaxses is bad, if possible: we had a section
site.ru/catalog/category/item
became
site.ru/en/catalog/category/item
In other words, the role of the index page is transferred to the shoulders of the subdirectory. In fact, just add an extra label to the first route for further processing of this label with edits appropriate for the language-region.

Question:
How can I set a condition in htaxes to check the first route, whether it includes the necessary (OR enumeration) values ​​(en \ fr ...), and if they are present, then rewrite where site.ru/$language essentially took the original structure of the site, as if there were no language route, i.e. according to the example above - site.ru/en/catalog/category/item, i.e. requests would go to site.ru/catalog/category/item

Thank you!

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question