Welcome! Log In Create A New Profile

Advanced

Joomla multilingual subdomain redirect/rewrite

June 15, 2012 10:46AM
Hi all,

I have a multilingual Joomla website, whose URL currently look like the following :
http://www.example.com/fr/test/test.html (note the FR posision after the server name)

In order to achieve some SEO, I'd like my URLs to look like this :
http://fr.example.com/test/test.html
Ie: the langage code is now part of the subdomain, and removed from the request_uri

I configured my DNS (fr.example.com and www.example) as A reccord pointing to the same IP address.

I tried the following rule, that match the fr langage code and display the correct URL, but I still have a 404 error because the server could not find the new rewritten page :

if ($request_uri ~* ^/(?<lang>fr)/(?<rest>.*)$ {
rewrite ^ http://$lang.example.com/$rest? permanent;
}

Now, I'm looking for a way to tell the server to serve the page /fr/test/test.html when the URL is http://fr.example.com/test/test.html
Should I add a location @lang {} directive ? or use proxy pass ?

I'm quite new to Nginx, and I'm lost :(

Moreover, I have several country codes such as: de, fr, cn, it... In this post i'm focusing on the fr one, but i'm looking for a generic solution.

Thanks !
Subject Author Posted

Joomla multilingual subdomain redirect/rewrite

clemclem June 15, 2012 10:46AM

Re: Joomla multilingual subdomain redirect/rewrite

clemclem June 17, 2012 02:15PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 253
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready