I have an issue with my nginx config for my joomla site.
I want to rewrite/redirect based on the tld used. Example:
- domain.fr -> domain.com/fr
- domain.se -> domain.com/se
How can I achieve this?
I have an issue with my nginx config for my joomla site.
I want to rewrite/redirect based on the tld used. Example:
How can I achieve this?
You can use regex in server_name in order to get the TLD in a variable:
server_name ~(www\.)?domain\.(?<tld>\w+)$;
Now you can use it:
rewrite ^(.*)$ /$tld/$1;