Language Change ? Information Required Success

User tests: Successful: Unsuccessful:

avatar RolandSM
RolandSM
26 Apr 2020

Summary of Changes

New plugin parameter in plg_languagefilter to allow removing trailing slash.

Testing Instructions

Install latest 3.9.x with min. 2 multilingual setup.
Open frontend with mod_breadcrumb & mod_languages.
Mouseover the icons/urls leads to an url WITH trailing slash.
Apply patch.
Refresh frontend and mouseover the icons/urls leads to an url WITH trailing slash. (no changes)
Go into backend -> plugins -> plg_languagefilter and set new param "remove trailing slash" to YES.
Reload frontend and mouseover breadcrumb-links or language flags.
Trailing slash is removed.

Expected result

Many SEO tools show this topic as duplicate content.
Google says its not but even its a nicer way to fix one thing with or without trailing slash.

Actual result

Current code in line 230 set a trailing slash to every url.

Documentation Changes Required

avatar RolandSM RolandSM - open - 26 Apr 2020
avatar RolandSM RolandSM - change - 26 Apr 2020
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 26 Apr 2020
Category Administration Language & Strings Front End Plugins
avatar coolcat-creations
coolcat-creations - comment - 26 Apr 2020

Thank you for your first PR great addition!

avatar HLeithner
HLeithner - comment - 26 Apr 2020

Thanks for you PR could you please rebase it for j4, since we are in feature freeze for j3?

avatar Bakual
Bakual - comment - 26 Apr 2020

Do we really need a parameter for this?
Or is there a reason why someone would want to have the trailing slash? Does something break without the slash?

ATTENTION! Please check functions like language switcher, breadcrumbs, login and user profile change!

What does this mean? Does it work or not? If it doesn't work, you can as well close this PR as it will never be accepted if a parameter breaks basic CMS functions. 😄

avatar RolandSM
RolandSM - comment - 26 Apr 2020

The parameter is here, that a user have to activate this explicitly.
Some 3rd party extensions can stop working. From core side I haven´t found something not working with.
This is only useful, if a .htaccess redirect to trailing slash or not is also existing.

avatar infograf768
infograf768 - comment - 26 Apr 2020

If it can break some 3rd party extension, it means it is not fully B/C.

avatar zero-24
zero-24 - comment - 26 Apr 2020

Well there for it is disabled by Default JM.

avatar zero-24
zero-24 - comment - 26 Apr 2020

So no b/c break by that

avatar RolandSM
RolandSM - comment - 26 Apr 2020

Hello @infograf768
you already saw such pull reqeusts in the last years.
But none of them comes into core...

avatar richard67
richard67 - comment - 26 Apr 2020

I love my trailing slash and want to keep it. So for me it is good to have it confugurable if this PR will be accepted.

avatar brianteeman
brianteeman - comment - 26 Apr 2020

Is this only an issue on multlingual web sites?

avatar infograf768
infograf768 - comment - 26 Apr 2020

Please give me time to test tomorrow before hurrying on this.

avatar RolandSM
RolandSM - comment - 26 Apr 2020

I love my trailing slash and want to keep it. So for me it is good to have it confugurable if this PR will be accepted.

Yes, the idea was that anyone can fix to one of the two versions, but then run it through the whole site to make it consistent.

avatar RolandSM
RolandSM - comment - 26 Apr 2020

@infograf768
No problem. This is useful with a htacces redirect like:

Remove Trailing Slash

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ /$1 [R=301,L]

Note: This is case without trailing slash.

avatar RolandSM
RolandSM - comment - 26 Apr 2020

Is this only an issue on multlingual web sites?

No this should be on every site.
Normally every Joomla can be accessed with or without trainling slashes...
See in breadcrumb or other linking modules if the refer to an url with or without...

avatar richard67
richard67 - comment - 26 Apr 2020

Hmm, if it's not only a problem for multilingual sites but also for monolingual sites, the language filter plugin is not the right place for that.

avatar RolandSM
RolandSM - comment - 26 Apr 2020

@richard67 Sorry, I have tested it and its not in monolinual sites.
Breadcrumb redirects to URLs without trailing slash... (without my modification)

avatar richard67
richard67 - comment - 26 Apr 2020

@RolandSM Then your answer above was at least misleading:

Is this only an issue on multlingual web sites?
No this should be on every site.

avatar infograf768
infograf768 - comment - 27 Apr 2020

A monolanguage site in 3.9 will always use by default a trailing slash for the home page when in a folder. (Evidently when sef and url rewriting are set to Yes).
Below Joomla is in the stagingcms folder.
http://localhost:8888/stagingcms/ is the home page.

Default breadcrumbs for home gives the same result.

For a multilingual site, same. But with the url lang code added when present.
The hreflang also use trailing slash for homes.

When Remove language code is set to Yes, after patch and setting Remove Trailing Slash to yes, hreflang keeps the url lang code for the default site language.

Before

Screen Shot 2020-04-27 at 07 34 49

After

Screen Shot 2020-04-27 at 07 33 08

Note

Behaviour in J4 is quite different by default from J3 as trailing slash is not present, but we have an issue with hreflang for the default site language when Remove language code is set to Yes as it is not the same url depending on the home page displayed.

Not default site language

Screen Shot 2020-04-27 at 07 55 59

Default site language
Screen Shot 2020-04-27 at 07 56 26

avatar HLeithner
HLeithner - comment - 27 Apr 2020

The reason for the tailing slash might be done because of consistent. If your site is in root of the domain your url always ends with a slash (http://example.com/) that's done already by your browser. So your site home should always have a tailing slash.

The tailing slash comes from the past based on directory listing. If you opened a url of a directory on an apache server you automatically get a redirect to the url with a trailing slash (that's still the case). http://example.com/directory redirects you to http://example.com/directory/
IIRC this got interpreted by search engines for all links that doesn't end with an extension. To save resources they add a trailing slash automatically to prevent an redirect done by the server.
As example if a crawler does not find a "real link" (example.com/news.html) it my decides to save resources and add a slash to the link without an extension (example.com/news -> example.com/news/).

I don't know if this is still valid but joomla should only support the "right one".

avatar RolandSM
RolandSM - comment - 27 Apr 2020

Hello,

my tests until yet was only on EN/DE multilanguage sites.
Also I installed the Joomlas not in a subfolder.

Every page is in standard possible with and also without trailing slash.
Browsers already think about to remove it because it looks nicer, also no real user types an url with trailing slash.

So I decided for my pages, to remove it and make this consinstence with all subpages.

You can see the current result on https://medialekt.de/de and all subpages.
Every try with trailing slash results in non trailing slash from the htaccess redirect.
Also language switcher, breadcrumbs and the header alternate hreflang leads to non trailing slash.

My idea was to make this possible, that the author/admin of each site can set his version he prefer.

avatar Hackwar
Hackwar - comment - 28 Apr 2020

Sorry to be a party pooper here, but this is a rather bad solution for a non-problem. First of all, this is all based on the idea that there is such a thing like duplicate content on the same domain. This has been a myth for the last 10 years already. It is a nice, easy low-hanging-fruit for SEO people to show that they found SOME issue on your site, but especially the question if trailing slash or not, is pretty much irrelevant to your search ranking.

Then there is that Joomla generally only creates URLs without trailing slash. The language filter plugin is the only case where it does add that slash. So the correct fix would be to remove the slash, but due to lots of crappy routing code out there, we can't do that in 3.x and instead should do that in 4.0.

Adding a parameter also is not really an option, because either this works correct out of the box and thus we wouldn't need that parameter, or that parameter would always have to be set and then the user would even have to first find that option. People will change a billion settings before they come along this one.

Last but not least: This does NOT fix the problem. The problem is, that Joomla generates a few URLs with trailing slash. If you now remove that in an existing site, Google will index the same page both with and without trailing slash. Also: Joomla will still return the same page for both trailing and non-trailing slash.

This can not be changed in a B/C compliant way in 3.x. We can change it in 4.0.

avatar RolandSM
RolandSM - comment - 30 Apr 2020

Okay I see, so what's next with this PR?

avatar infograf768
infograf768 - comment - 1 May 2020

Okay I see, so what's next with this PR?

I guess, even if it is a disabled parameter per default, that the consensus is to not merge this.

avatar RolandSM RolandSM - change - 15 May 2020
Labels Added: ? ?
avatar RolandSM
RolandSM - comment - 16 May 2020

So I should close this PR?

avatar chmst
chmst - comment - 6 Apr 2022

@RolandSM Sorry for the late answer and thank you for your contribution! I am closing this now.

avatar chmst chmst - change - 6 Apr 2022
Status Pending Closed
Closed_Date 0000-00-00 00:00:00 2022-04-06 18:18:30
Closed_By chmst
Labels Added: Language Change ?
Removed: ? ?
avatar chmst chmst - close - 6 Apr 2022

Add a Comment

Login with GitHub to post a comment