I know this question has been asked so many times, but I have not found any working solution or example that I can use to fix my problem.
I work on a client site. There are two similar sites: one for your country, the second for visitors to other countries.
Their main site is located in the root of the server and the second site, located in a subfolder.
Now I want the dynamic url to be rewritten for the second site, which is located in a subfolder with the country code of the user who visited.
For instance,
http://example.com
http://example.com/subfolder/
are the urls.
I want this to http://example.com/subfolder/be changed to this http://example.com/country_code/, where country_codeis the visitor's country code in ISO format, passing through the php function.
, , subfolder us, URL- http://example.com/us/.
, , , , , .
, http://example.com/subfolder/any-type-of-url/ = > http://example.com/country_code/any-type-of-url/
country_code - / ISO.
, - . Advance.
PS: add_rewrite_rule(), WP.