Bit of a bizarre and unhelpful question but I am unsure how to get to the bottom of this one currently...

All the trailing slashes are being removed and 301 redirected to the URLs without a trailing slash and I cannot figure out where this is occurring.

  • There isn't anything in .htaccess handling this.
  • There isn't a URL suffix handling this for products or categories.
  • There is no local code pool Mage override handling this.
  • As far as I can make out, there are no third party extensions handling this.

The worrying thing is, I think I myself set this up...

Any other ideas?


Actually, I just replaced the .htaccess with the default one from Magento and the URLs with the trailing slash did not 301 redirect to those without so it actually seems like it is something missing in the .htaccess that is actually needed in order for these to resolve... This should be interesting!


Wow, this is quite incredible.

This had nothing to do with anything in mod_rewrite at all.

Or anything that we had even customised in .htaccess.

cPanel, or the hosting company for this particular store were auto-inserting stuff in the file, specifically, the below:-

# php -- BEGIN cPanel-generated handler, do not edit
# Set the “ea-php56†package as the default “PHP†programming language.
<IfModule mime_module>
  AddType application/x-httpd-ea-php56 .php .php5 .phtml
# php -- END cPanel-generated handler, do not edit

Removing this no longer caused URLs with a trailing slash to 301 redirect to those without. Can't say I see how but then, I am not overly familiar with mime_module. Either way, this is plain ridiculous and needless to say, we do not handle the hosting for this website!


Oh brilliant! Found out that PHP on the server had been updated to version 7 and no-one had even informed us or even consulted us on this (thus likely triggering the auto-insertion of mime_type into .htaccess). Sigh.

Anyway, hope this helps someone out there one day!

  • 1
    If it's solved, please mark your answer as accepted. :) – sv3n Feb 28 '18 at 0:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.