-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Multilanguage: Implementing a 301 when Removing URL Language Code #5129
Conversation
@test |
@test |
Looks like you are confusing SEF and SEF rewriting. :) |
I have already test this, it's working for both cases "remove language code from url" set to "yes" or set to "no" |
@infograf768 |
I will post back as soon as i have the duplicated content fixed. Right now i have about 350 duplications. 301 is working properly since 2 days. Probably in about 2 weeks they are going to be fixed. |
In the last case there is no redirect indeed |
You are right once again. |
why are you doing the whole $uri->base().$uri->toString(array()) stuff? $uri->toString() would be the same... |
@Hackwar |
@infograf768 Tested: Condition are:
1st interaction. Being already in the Italian site go to another page: 2nd interaction. Language Switcher to English: 3rd interaction. Language Switcher back to Italian: |
Good find! |
Well... it is more the 5th that concerns me from an architectural point of view (303 for a user logging in and being redirected is totally OK). |
I did not get the 5th one here. Just the 303 when user logs in. When switchinh back to the default language I have a 301 |
Concerning the implementation: |
OOPS... that's strange... How can this be? |
I am using Tamper Data addon for Firefox to trace this. |
@smanzi fully agree with you here. Having 7 $app->redirect()s in the parse rule with mostly the same code looks pretty bad. Likewise with half a dozen checks if self::$sefs[$sef]. Simply said, this code is so complex, that I have huge difficulties reading/understanding it. Equally with imploding the array at one point and concatenating strings at the other point. |
My screenshots are from the native Firefox inspector, Network view: try with that... |
@Hackwar pfuiiii.... you make me feel a bit less dull: I broke my head trying to get a grasp of it! |
@Hackwar Evidently, the base is flawed! We were told to wait for the UCM, etc. to get a real multilingual Joomla!. I.e. was to be for version 3.... I have fought since I co-founded Joomla! for languages and multilanguage. Apart from these 3, no one has worked on it deeply. No one. We have simply corrected and improved on the base we had to be B/C and I had to always beg to get testers. This PR is a little improvement for those who care for SEO. |
@smanzi |
@infograf768 OK, I will re-test, try to replicate on-line and then get in touch with you... |
JM, I'm not saying that your work is not appreciated or that what you are trying to achieve is wrong. Quite the contrary. But I'm saying that when you are going to invest work into this, then please make it right and rewrite this plugin. I'm more than happy to help you out with this, but to be able to help you, I need to be able to understand what it is that you are trying to achieve with that plugin. The way the code is written, that is not possible right now, since it simply is too complex. As you rightly said, UCM is dead. But I don't see why we couldn't get a proper multilang implementation in 3.x. And you know very well that I have to beg for every test and change as well. |
@infograf768 I confirm I have both 303 and 301 also with my on-line test site. You can check at:
If you wish, just tell me and I'll send you credentials for admin/FTP/cPanel |
... there is also an Akeeba Backup .jpa file to download, if you prefer... |
@infograf768 If you want to consistently see my behavior, after (or even before!) point 5 click again on the flag of the same language you are already into: then you will start seeing 303 + 301 Something similar happens also on the home page even for not logged-in users: Starting with a fresh (no cookie) browser:
|
Some more info. Even for not logged in users:
|
May it be possible that everything derives from the need of having (explicitly for NON-SEF, implicitly for SEF) the lang=xx parameter on the URI, even for the default language? If without SEF enabled I go to the home page I get this:
Now think of this: if we modify the rules of the game and we say: we levy the need of the lang parameter and if it is missing from the NON-SEF URL we just serve the default language? In Language Module:
in languagefilter:
Everything seems to me to be B/C too... |
the switchlang=xx parameter should also be added to the login logic... |
@smanzi: Please test my demo site above and
No, it is impossible and I do not confirm it at all. SEF off we always get a 200 directly. |
@smanzi Let's share screen there and I will show you |
@test |
@infograf768 My site is stock 3.3.6 with the following exceptions:
I'm going to open Skype later (about 1 hour...) Don't you have TeamViewer for screen sharing? I normally use that... never tried with Skype... |
On Jean-Marie site try switching between fr-FR and en-GB several times: at one point it start issuing 303 as well. Once started it does consistently. At least, this is what I'm seeing here: if nobody else has this problem it must be something local on my PC (Windows 8.1, Firefox 33.1) |
I think we are going to merge this as we have already many positive tests and you are the only one to get a 303 for current navigation. I am on skype right now if you want to see here what goes on |
Sorry but i can not follow sometimes, it gets complicated for me. But if you need any help testing or an opinion let me know. |
@infograf768
As you wish, but as I told you in the other PR I have other concerns about having many links generating 301 on a site and namely:
I trust you, but as you've probably seen on my last screenshot I'm getting those also on your site... I will probably be on-line later if... I don't have to rush to the hospital: kidney stones are haunting me since a couple of days 😧 |
Providing a bunch of improvements to the languagefilter plugin: #5135 |
I think i found a way to reproduce the 303s ... First clear browser cache and then go to http://info-graf.fr/multi/ In Firefox switch to italian, french, italian, english (301), italian, french, italian, english -> 303 and you are still on italian. In Chromium i had to go through this cycle one more time and on the last switch to english i get 301 + 303 and am still on italian. Now deactivate caching in Firebug and Chromium Dev Tools (didn't find a way for Firefox Dev Tools) and try again: all should be fine (no more 303). So maybe the question is: do crawlers use cache? |
I guess that crawlers do not use your browser, therefore not the browser cache. |
This patch is now included in Hannes PR #5135 |
#5135 includes this code. Closing. |
Change language string names Add extra large class to field Don't check for empty new url if in advanced mode Remove not null constraint in db Remove not null constraint in db (2/2) Add extra check for a 3xx code Port to all databases Add missing update files
See wrong PR here (because the true is not placed where it should) and discussion: #5092
Test instructions, set a multilanguage site with en-GB as default site
When hovering on the language switcher module to get to the default site language, copy the link
It will be of the type http://mysite.com/en/ (if en-GB is the default site language)
Open this online checker: http://redirectdetective.com/
Enter the link you just copied. See results.
=>303 redirect
Apply patch, and test again the same link in http://redirectdetective.com/
=> 301 redirect
Here is a live example of a site where the patch has been applied:
Go to:
http://info-graf.fr/multi/fr/blog-fran%C3%A7ais-%C3%A5-tester/2-article-fr-fr.html
Hover the English flag of the language switcher.
The link is http://info-graf.fr/multi/en/home-en-gb/8-category-en-gb/1-article-en-gb.html
Copy the link in http://redirectdetective.com/ and Trace url.
It will show that the redirect is a 301