This redirects (301 moved permanently) url requests missing trailing slash / on category to category with trailing slash, only if seo category type selected is non file (trailing slash /). Example request for domain.com/tools redirects (301) to domain.com/tools/
Make a backup of func.php in /addons/seo before proceeding.
In function fn_seo_get_route (about line 278) find the following code:
// For the locations wich names stored in the table
if (!empty($objects) && !empty($objects['object_name'])) {
$_seo = db_get_row("SELECT * FROM ?:seo_names WHERE name = ?s", $objects['object_name']);
if (empty($_seo) && !empty($objects['extension'])) {
$_seo = db_get_row("SELECT * FROM ?:seo_names WHERE name = ?s", $objects['object_name'] . '.' . $objects['extension']);
}
This will ensure that categories do not end up with duplicate content, and all non trailing slash requests are redirected to trailing slash equivalent.
furthermore, this code only works id i place AFTER THE } closing tag of
if (empty($_seo) && !empty($objects['extension'])) {
$_seo = db_get_row("SELECT * FROM ?:seo_names WHERE name = ?s ?p", $objects$
if (empty($_seo)) {
$_seo = db_get_row("SELECT * FROM ?:seo_names WHERE name = ?s", $ob$
}
[size=3][font=verdana, geneva, sans-serif]So direct links to /product redirects to /product/ and /category redirects to /category/ ?
What about /checkout or /cart and other paths without specific file names in the path? Would you have to use the “SEO Rules Manager” within the Admin panel?
@ VALI
Thanks for your suggestion.
This change doesn't seem to do anything for me. I do not see a trailing slash “/” for any category, when i visit a category URL without the “/”, whether or not if I use these changes. Strange?
Would something along the lines of this also work?