-
to add trailing slashes in the URL you need to edit the file public_html/libraries/src/Router/SiteRouter.phppublic function buildRewrite(&$router, &$uri)
add the string. '/' in the following line of code $uri->setPath($route . '/');I was wondering if it is possible to add as a new feature to be activated from the admin area |
Beta Was this translation helpful? Give feedback.
Replies: 10 comments 20 replies
-
Why would you want to do this? |
Beta Was this translation helpful? Give feedback.
-
To add trailing slash without any plugin or htaccess code. |
Beta Was this translation helpful? Give feedback.
-
Trailing slashes should - if ever - not be added to ANY URL but only to those of directory stile, e.g. "www.some-domain.com/en/" or "www.some-domain.com/de/", but not "www.some-domain.com/index.php/" or "www.some-domain.com/somecategory/somealias.html/". As it is possible to switch on suffix (e.g. ".html") in the configuration, your proposed solution is simply wrong and would break such URLs. Your solution may for you in your particular use case but not for everybody. |
Beta Was this translation helpful? Give feedback.
-
In Fact I mean this solution for cases like www.domain.com/en/category/ or www.domain.com/en/category/article/ I was wondering if it is possbile add this feature with a switch in the web admin area and if the suffix was enabled the trailing slashes button has to set to no add or disabled. |
Beta Was this translation helpful? Give feedback.
-
Well the trailing slashes are a relict from old times. Meanwhile Google doesn't recommend or require them anymore. They do not do any harm, but they also serve no benefit. |
Beta Was this translation helpful? Give feedback.
-
Guess this issue could be closed. @richard67 Could you please make final decision here? |
Beta Was this translation helpful? Give feedback.
-
@joomdonation I don’t like to make decisions. Maybe move it to discussions? |
Beta Was this translation helpful? Give feedback.
-
OK. Thanks. I'm moving this to discussions so that it could be discussed further if needed. |
Beta Was this translation helpful? Give feedback.
-
As an SEO-Senior i can tell you that this issue DOES matter. Why? Google recommends to use EITHER no trailing slash oWITH trailing slash and RECOMMENDS to be consistent here. Also this would help me (current project in fact) to migrate a Wordpress-Site to Joomla. Because wordpress uses Trailing Slashes "/" on every url and joomla does not. So i would have to make a 301-redirect for every single site (with relevant rankings) to the new joomla URL with no trailing slash. If i dont do this - the old Wordpress URLS would also be working on the joomla ist (if URL structure is the same) and produce URLS with Trailing slash (from old wordpress urls who are still in the google index) and without trailing slash (internal joomla linking). joomla 4 needs the following SEO-Settings:
in my opinion this is a "design-flaw" that should have been adressed already in joomla 3 and i am really surprised why this isnt yet fixed in joomla 4 because it makes the lifes and work of seo-agencies much more difficult and is not a [+] point when it comes to the choice "wordpress OR Joomla". greetings, |
Beta Was this translation helpful? Give feedback.
-
As @richard67 wrote, we shouldn't have the slashes at the end and Joomla does not render the URLs with a slash at the end. We are not going to add this as a switch in the configuration somewhere. We already have far to many switches and those create additional issues. If you need a slash at the end, you can write a plugin to do this. I'm going to close this discussion with that. |
Beta Was this translation helpful? Give feedback.
Trailing slashes should - if ever - not be added to ANY URL but only to those of directory stile, e.g. "www.some-domain.com/en/" or "www.some-domain.com/de/", but not "www.some-domain.com/index.php/" or "www.some-domain.com/somecategory/somealias.html/". As it is possible to switch on suffix (e.g. ".html") in the configuration, your proposed solution is simply wrong and would break such URLs. Your solution may for you in your particular use case but not for everybody.