User tests: Successful: Unsuccessful:
New plugin parameter in plg_languagefilter to allow removing trailing slash.
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.
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.
Current code in line 230 set a trailing slash to every url.
Status | New | ⇒ | Pending |
Category | ⇒ | Administration Language & Strings Front End Plugins |
Thanks for you PR could you please rebase it for j4, since we are in feature freeze for j3?
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.
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.
If it can break some 3rd party extension, it means it is not fully B/C.
Well there for it is disabled by Default JM.
So no b/c break by that
Hello @infograf768
you already saw such pull reqeusts in the last years.
But none of them comes into core...
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.
Is this only an issue on multlingual web sites?
Please give me time to test tomorrow before hurrying on this.
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.
@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.
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...
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.
@richard67 Sorry, I have tested it and its not in monolinual sites.
Breadcrumb redirects to URLs without trailing slash... (without my modification)
@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.
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
AfterBehaviour 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
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".
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.
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.
Okay I see, so what's next with this PR?
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.
Labels |
Added:
?
?
|
So I should close this PR?
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: ? ? |
Thank you for your first PR great addition!