to add trailing slashes in the URL you need to edit the file
public function buildRewrite(&$router, &$uri)
{
// Get the path data
$route = $uri->getPath();
// Transform the route
if ($route === 'index.php') {
$route = '';
} else {
$route = str_replace('index.php/', '', $route);
}
$uri->setPath($route);
}
add the string. '/' in the following line of code
I was wondering if it is possible to add as a new feature to be activated from the admin area
Labels |
Removed:
?
|
Labels |
Added:
No Code Attached Yet
|
To add trailing slash without any plugin or htaccess code.
Do you think is possible add this new feature?
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 configron, 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.
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.
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.
Guess this issue could be closed. @richard67 Could you please make final decision here?
@joomdonation I don’t like to make decisions. Maybe move it to discussions?
OK. Thanks. I'm moving this to discussions so that it could be discussed further if needed.
Status | New | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2022-11-14 07:37:11 |
Closed_By | ⇒ | joomdonation |
Why would you want to do this?