Double language code in URL - SEF gives 404

General questions regarding the use of languages in Joomla! 2.5.

Moderators: infograf768, General Support Moderators

Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.
PaysB
Joomla! Apprentice
Joomla! Apprentice
Posts: 12
Joined: Sun May 08, 2011 9:42 am

Double language code in URL - SEF gives 404

Postby PaysB » Sun May 08, 2011 9:58 am

I've just finished setting up my first Joomla! 1.6.3 website including language switch for 2 languages (fr and nl).

I've set up the language switch according to the advice I found on this forum, including default menu for All (menu module unpublished), individual default menus for every single language, three root categories (all, fr, nl) etc.

The website is working fine and the language switch also. I see the flags and when I click on one of them, I am redirected to the corresponding language.

However, when I set SEF to Yes, I can still see the homepage, but when I click on a menu or a flag a get a 404 error (Category Not Found). The URL on the 404 page has a double language code (index.php/nl/nl/tarieven instead of index.php/nl/tarieven). When I delete one "nl" in the URL, the page is loading correctly.

I have no clue where this problem comes from. I would be very glad if someone could give me some advice :-)

User avatar
infograf768
Joomla! Master
Joomla! Master
Posts: 18078
Joined: Fri Aug 12, 2005 3:47 pm
Location: **Translation Matters**

Re: Double language code in URL - SEF gives 404

Postby infograf768 » Sun May 08, 2011 2:19 pm

What happens when you set htaccess to off?
Jean-Marie Simonet / infograf · http://www.info-graf.fr
Multilanguage in 2.5: http://help.joomla.org/files/EN-GB_multilang_tutorial.pdf
---------------------------------
ex-Joomla Translation Coordination Team • ex-Joomla! Production Working Group

PaysB
Joomla! Apprentice
Joomla! Apprentice
Posts: 12
Joined: Sun May 08, 2011 9:42 am

Re: Double language code in URL - SEF gives 404

Postby PaysB » Sun May 08, 2011 3:52 pm

Bonjour Jean-Marie,

In the root dir of the site there is just one file named htaccess.txt and no .htaccess, so I guess it was already deactivated (if that is what you meant).

The site I am testing with is on a local machine using XAMPP for Windows

User avatar
infograf768
Joomla! Master
Joomla! Master
Posts: 18078
Joined: Fri Aug 12, 2005 3:47 pm
Location: **Translation Matters**

Re: Double language code in URL - SEF gives 404

Postby infograf768 » Sun May 08, 2011 4:10 pm

If you set "Use URL rewriting" to Yes in Global Configuration and .htaccess is not present, that could very well be the reason.

Test first by setting "Use URL rewriting" to No.
Test then by setting it to Yes and change htaccess.txt to .htaccess (not sure it works on Windows)
Jean-Marie Simonet / infograf · http://www.info-graf.fr
Multilanguage in 2.5: http://help.joomla.org/files/EN-GB_multilang_tutorial.pdf
---------------------------------
ex-Joomla Translation Coordination Team • ex-Joomla! Production Working Group

PaysB
Joomla! Apprentice
Joomla! Apprentice
Posts: 12
Joined: Sun May 08, 2011 9:42 am

Re: Double language code in URL - SEF gives 404

Postby PaysB » Tue May 10, 2011 7:52 am

At the moment my hosting company does not allow me to modify the htaccess file. Strange, because I should be allowed to do this. I am currently working on this problem with their support desk. When this has been fixed, I can continue working on the SEF issue.

PaysB
Joomla! Apprentice
Joomla! Apprentice
Posts: 12
Joined: Sun May 08, 2011 9:42 am

Re: Double language code in URL - SEF gives 404

Postby PaysB » Tue May 10, 2011 8:59 pm

Well, I did some more testing on a Linux machine with Apache this time.

I uploaded an empty htaccess file to my server. Then in the Joomla! backend I switched the following settings:

Search Engine Friendly URLs: NO
Use URL rewriting: NO
Site and languages work

Search Engine Friendly URLs: YES
Use URL rewriting: NO
Homepage working, but clicking on menus gives 404 category not found, and double language code like index.php/nl/nl/tarieven

Search Engine Friendly URLs: YES
Use URL rewriting: YES
Whole website gives status Forbidden, You don't have permission to access /nl/ on this server.

Then I changed htaccess with the default Joomla! 1.6.3 htaccess file and I had the same test results as above.
I also tried commenting out

Code: Select all

Options +FollowSymLinks
, but still same results

g1smd
Joomla! Guru
Joomla! Guru
Posts: 951
Joined: Mon Feb 21, 2011 4:02 pm
Location: UK

Re: Double language code in URL - SEF gives 404

Postby g1smd » Tue May 10, 2011 9:36 pm

You can test whether .htaccess and mod_rewrite works on your site using instructions here:
http://docs.joomla.org/How_to_check_if_ ... our_server


Joomla 1.6.3 onwards comes with a different file for use on some types of Windows server.
The file is called "web.config.txt" and can be found in the root folder of the distribution package.
Online since 1995.

PaysB
Joomla! Apprentice
Joomla! Apprentice
Posts: 12
Joined: Sun May 08, 2011 9:42 am

Re: Double language code in URL - SEF gives 404

Postby PaysB » Wed May 11, 2011 9:46 am

You can test whether .htaccess and mod_rewrite works on your site using instructions here:
http://docs.joomla.org/How_to_check_if_ ... our_server

I ran the test and it shows that .htaccess and mod_rewrite are working for my site.

I am actually running this live website on Linux / Apache hosting. So no need for Windows configuration.

User avatar
infograf768
Joomla! Master
Joomla! Master
Posts: 18078
Joined: Fri Aug 12, 2005 3:47 pm
Location: **Translation Matters**

Re: Double language code in URL - SEF gives 404

Postby infograf768 » Wed May 11, 2011 10:29 am

PaysB wrote:
You can test whether .htaccess and mod_rewrite works on your site using instructions here:
http://docs.joomla.org/How_to_check_if_ ... our_server

I ran the test and it shows that .htaccess and mod_rewrite are working for my site.

I am actually running this live website on Linux / Apache hosting. So no need for Windows configuration.

Sent you a pm.
Jean-Marie Simonet / infograf · http://www.info-graf.fr
Multilanguage in 2.5: http://help.joomla.org/files/EN-GB_multilang_tutorial.pdf
---------------------------------
ex-Joomla Translation Coordination Team • ex-Joomla! Production Working Group

flash77
Joomla! Apprentice
Joomla! Apprentice
Posts: 6
Joined: Sat May 14, 2011 6:55 pm

Re: Double language code in URL - SEF gives 404

Postby flash77 » Sat May 14, 2011 7:03 pm

Hi,
I've got the same problem - double language codes with following SEO options turned on:
Search Engine Friendly URLs: YES
Use URL rewriting: YES

I am using a quite huge .htaccess which was published here http://www.joomla-security.de/downloads/themen/dateien-und-verzeichnisse/htaccess-joomla-6.zip.

On top of that my Joomla installation currently run within a sub-folder of the http.folder, no automatic rewrite to that subfolder at the moment.

Is it the htaccess that leads to the double langauge code?

g1smd
Joomla! Guru
Joomla! Guru
Posts: 951
Joined: Mon Feb 21, 2011 4:02 pm
Location: UK

Re: Double language code in URL - SEF gives 404

Postby g1smd » Sat May 14, 2011 7:46 pm

When you mix RedirectMatch and RewriteRule in the same site you can sometimes get unexpected operation. This happens because the .htaccess file is scanned in per-module order. If mod_alias ever runs AFTER mod_rewrite you will end up with a disaster.


Every mention of [F,L] should be [F].


|jpg|jpeg| can be simplified to |jpe?g|


|html|htm| can be simplified to |html?|


The multiple conditions, such as
RewriteCond %{QUERY_STRING} tp=(.*)
RewriteCond %{QUERY_STRING} template=(.*)
can be combined into one condition:
RewriteCond %{QUERY_STRING} (^|&)t(p|mpl|emplate)=([^&]+)(&|$)
which runs a LOT faster.


Not withstanding the use of RedirectMatch as noted above, when looking at patterns such as this:
RedirectMatch 404 \/query\/
slashes should not be escaped, so \/query\/ should be /query/


Likewise, underscores do not need to be escaped:
RedirectMatch 404 db\_name
where db\_name should be db_name


Incorrect syntax can cause random unexpected things to happen when RegEx libraries are updated.

However, in this case the problems you have are likely being generated by a logic error somewhere in the PHP. I don't suspect mod_rewrite to be the culprit.
Online since 1995.

flash77
Joomla! Apprentice
Joomla! Apprentice
Posts: 6
Joined: Sat May 14, 2011 6:55 pm

Re: Double language code in URL - SEF gives 404

Postby flash77 » Sun May 15, 2011 7:45 am

I have exchanged the above posted htaccess with the standard htaccess that comes with the Joomla installation. No success, still the menu items create links with double language codes....

any idea?

Patrick

PaysB
Joomla! Apprentice
Joomla! Apprentice
Posts: 12
Joined: Sun May 08, 2011 9:42 am

Re: Double language code in URL - SEF gives 404

Postby PaysB » Sun May 15, 2011 9:15 am

I had some direct conversation with infograf768. My problem is probably caused by a corrupted installation of my Joomla version (1.6.3).

I started developing my website with version 1.6.1 During the building process I upgraded Joomla via the build in update wizard. I did this a few weeks ago, and I remember that the upgrade did not succeed (it hung at some point). Then I did a manual upgrade with an upgrade pack 1.6.1 - 1.6.3.

At first, as SEF was not activated during the website development, I did not notice the double language code problem. It was only last week when I put the site on a live server, that I noticed this.

infograf768 advised me to overwrite my install with a full 1.6.3 pack. He said that it will not break anything as it will keep your configuration.php as well as your 3pd extensions as they are.

I did not try this yet though. So I cannot confirm if it is solving the problem or not

flash77
Joomla! Apprentice
Joomla! Apprentice
Posts: 6
Joined: Sat May 14, 2011 6:55 pm

Re: Double language code in URL - SEF gives 404

Postby flash77 » Sun May 15, 2011 9:22 am

I use a new Joomla installation with version 1.6.3, it seems like it will not be fixed when you upgrade to 1.6.3

Patrick

User avatar
infograf768
Joomla! Master
Joomla! Master
Posts: 18078
Joined: Fri Aug 12, 2005 3:47 pm
Location: **Translation Matters**

Re: Double language code in URL - SEF gives 404

Postby infograf768 » Sun May 15, 2011 9:29 am

FYI: PaysB site had a real problem in the sense that testing with Beez did not work at all when a module menu was set to display in position-7.
Also the error on his site happens also without URL rewriting. Just with SEF on.
Jean-Marie Simonet / infograf · http://www.info-graf.fr
Multilanguage in 2.5: http://help.joomla.org/files/EN-GB_multilang_tutorial.pdf
---------------------------------
ex-Joomla Translation Coordination Team • ex-Joomla! Production Working Group

PaysB
Joomla! Apprentice
Joomla! Apprentice
Posts: 12
Joined: Sun May 08, 2011 9:42 am

Re: Double language code in URL - SEF gives 404

Postby PaysB » Tue May 17, 2011 1:33 pm

Well, today I actually found out what the problem was. Patience patience, testing testing >:(

First I tried a re-install of a full Joomla! 1.6.3 pack on my webserver via Cpanel, but that messed up my whole website. No more templates loading, content and menus disappeared, white pages full of errors.

Then I decided to do a clean rebuild of the complete website on a local machine, starting with a 1.6.3 install, leaving SEF URL's active all the time, hoping that at one point the double language code bug would be reproduced on installation of a new component or plugin. And fortunately that happened.

I arrived at a point that I wanted to install Chronoforms V4 RC1.8. No problem for the component, but then I installed the plugin Chronoforms_J1.6_V4_RC1.8_Plugin.zip and after I published this plugin, VOILA ... double language code again.

I used this plugin, because I wanted to include a form in an article, using the code {chronoforms}name-of-form{/chronoforms}. For the time being I deactivated the plugin, and I will contact the makers.

flash77
Joomla! Apprentice
Joomla! Apprentice
Posts: 6
Joined: Sat May 14, 2011 6:55 pm

Re: Double language code in URL - SEF gives 404

Postby flash77 » Tue May 17, 2011 1:46 pm

WOW PaysB, thanks for detailed testing. It happens that I also use chronoforms!! Please leave a message here once you have recieved an asnwer from the chronoforms-developpers.

Thanks
Patrick

PaysB
Joomla! Apprentice
Joomla! Apprentice
Posts: 12
Joined: Sun May 08, 2011 9:42 am

Re: Double language code in URL - SEF gives 404

Postby PaysB » Tue May 17, 2011 3:06 pm

Deactivating the plugin, actually solved another issue for me as well: form validation wasn't working in IE9, but now it is ...

I replied on an existing post on this issue (double language code with Chronoforms plugin activated) on the ChronoEngine website. The post dates back to 22 april. No solution posted so far, but the forum administrator posted a message saying "I don't see anything in the Plug-in code that would change the URL at all".

rschling
Joomla! Fledgling
Joomla! Fledgling
Posts: 1
Joined: Sun May 29, 2011 6:47 pm

Re: Double language code in URL - SEF gives 404

Postby rschling » Sun May 29, 2011 6:56 pm

oops...sorry removed the post because i didnt read previous ones correctly and i found i have the same problem with SEF and Chronoforms

i just deactivated the component and not the plugin :)

hope there will be a solution soon

-Richard

PaysB
Joomla! Apprentice
Joomla! Apprentice
Posts: 12
Joined: Sun May 08, 2011 9:42 am

Re: Double language code in URL - SEF gives 404

Postby PaysB » Sun May 29, 2011 7:09 pm

It is not the component that causes the problem, but the chronoforms plugin. This is a plugin you have to install if you want to include a form in a Joomla article.

In administrator go to plugins and look up the plugin "chronoforms" and deactivate this plugin. This means that you cannot publish chronoforms forms into articles anymore, but if you have for example plain text in your form (like an intro text before you start the actual from) you can also insert this into the form HTML via the Chronoforms component interface.

User avatar
kmchen
Joomla! Apprentice
Joomla! Apprentice
Posts: 34
Joined: Sat Oct 21, 2006 12:57 am
Location: marseille (13) france
Contact:

Re: Double language code in URL - SEF gives 404

Postby kmchen » Tue Jun 07, 2011 1:14 pm

I get the same problem on 2 joomla sites 1.6.1 and 1.6.3 with 2 languages. Everythings works fine until I rename htaccess and check url rewriting. Front page gives
The requested URL /website.name/fr/ was not found on this server.

User avatar
infograf768
Joomla! Master
Joomla! Master
Posts: 18078
Joined: Fri Aug 12, 2005 3:47 pm
Location: **Translation Matters**

Re: Double language code in URL - SEF gives 404

Postby infograf768 » Tue Jun 07, 2011 3:29 pm

Same problem, same solutions.

Most certainly check your 3pd extensions.
Jean-Marie Simonet / infograf · http://www.info-graf.fr
Multilanguage in 2.5: http://help.joomla.org/files/EN-GB_multilang_tutorial.pdf
---------------------------------
ex-Joomla Translation Coordination Team • ex-Joomla! Production Working Group

User avatar
kmchen
Joomla! Apprentice
Joomla! Apprentice
Posts: 34
Joined: Sat Oct 21, 2006 12:57 am
Location: marseille (13) france
Contact:

Re: Double language code in URL - SEF gives 404

Postby kmchen » Wed Jun 08, 2011 9:17 am

Pure Joomla install with only a few templates and a template selector module+plugin. Standard Beez2 template selected as default and 3pd module+plugin unpublished.
Same problem.
Did you ever see a Joomla 1.6 multilanguage running with url rewriting ?

User avatar
infograf768
Joomla! Master
Joomla! Master
Posts: 18078
Joined: Fri Aug 12, 2005 3:47 pm
Location: **Translation Matters**

Re: Double language code in URL - SEF gives 404

Postby infograf768 » Wed Jun 08, 2011 9:49 am

kmchen wrote:Pure Joomla install with only a few templates and a template selector module+plugin. Standard Beez2 template selected as default and 3pd module+plugin unpublished.
Same problem.
Did you ever see a Joomla 1.6 multilanguage running with url rewriting ?


This is my demo site

http://info-graf.fr/trunk/en/multi-ling ... s-by-steps
Jean-Marie Simonet / infograf · http://www.info-graf.fr
Multilanguage in 2.5: http://help.joomla.org/files/EN-GB_multilang_tutorial.pdf
---------------------------------
ex-Joomla Translation Coordination Team • ex-Joomla! Production Working Group

User avatar
kmchen
Joomla! Apprentice
Joomla! Apprentice
Posts: 34
Joined: Sat Oct 21, 2006 12:57 am
Location: marseille (13) france
Contact:

Re: Double language code in URL - SEF gives 404

Postby kmchen » Thu Jun 09, 2011 8:08 am

Oups. mod_rewrite wasn't enabled on that new server. Thanks a lot Infograf for your very quick answers.

AlexandrosG
Joomla! Fledgling
Joomla! Fledgling
Posts: 2
Joined: Tue Jun 21, 2011 10:06 am

Re: Double language code in URL - SEF gives 404

Postby AlexandrosG » Tue Jun 21, 2011 10:21 am

Hi! I have the same problem but it doesn't happen for all positions of my template.
When i put the Language Switcher in Sidebar or Bottom positions of my template the flag links are ok. When i use other positions the flag links are "..../en/en/" and ".../gr/en/" which does not work!
This is strange!

I tried to disable some extra components and plugins but i saw no difference.

I suppose that SEO/SEF changes the links after they are generated by the mod_languages module.
Can the SEF/SEO responsible component/plug-in be responsible for this?

User avatar
infograf768
Joomla! Master
Joomla! Master
Posts: 18078
Joined: Fri Aug 12, 2005 3:47 pm
Location: **Translation Matters**

Re: Double language code in URL - SEF gives 404

Postby infograf768 » Sun Jun 26, 2011 1:49 pm

Native 1.6 SEF is integrated with languagefilter/langswitcher.
Are you using any other SEF extension?

It is weird that you get indeed different urls depending on the switcher position in the template.
Jean-Marie Simonet / infograf · http://www.info-graf.fr
Multilanguage in 2.5: http://help.joomla.org/files/EN-GB_multilang_tutorial.pdf
---------------------------------
ex-Joomla Translation Coordination Team • ex-Joomla! Production Working Group

AlexandrosG
Joomla! Fledgling
Joomla! Fledgling
Posts: 2
Joined: Tue Jun 21, 2011 10:06 am

Re: Double language code in URL - SEF gives 404

Postby AlexandrosG » Mon Jun 27, 2011 8:26 am

I have not explicitely installed any other SEF extension, but my template is based on Gantry Framework and i cannot say for sure that there is not any part of code in this Framework that modifies SEF.

I changed a bit the buildRule function of languagefilter.php in order to avoid this strange behaviour. This is my change (i use English and Greek language):

...
if (self::$mode_sef) {
$uri->delVar('lang');
if (!((stristr($uri->getPath(),"/en/"))||(stristr($uri->getPath(),"/gr/"))))
$uri->setPath($uri->getPath().'/'.$sef.'/');
}
...

So far, i am ok with this change, but i don't like not to know what is going on with my joomla! :-\

d34d
Joomla! Fledgling
Joomla! Fledgling
Posts: 1
Joined: Wed May 25, 2011 2:57 pm

Re: Double language code in URL - SEF gives 404

Postby d34d » Wed Jul 06, 2011 1:39 pm

thank you.. Chronoforms was causing the same issue here. Disabling the plugin was enough to stop the problem

Chabo
Joomla! Apprentice
Joomla! Apprentice
Posts: 16
Joined: Tue Mar 08, 2011 3:33 pm

Re: Double language code in URL - SEF gives 404

Postby Chabo » Fri Nov 04, 2011 1:25 pm

Just let you know, same problem with Nice Ajax Poll module for Joomla 1.7

Regards!


Return to “Language - Joomla! 2.5”

Who is online

Users browsing this forum: No registered users and 2 guests