PrestaShop Unfriendly URLs as Shortcuts
PrestaShop has built in support for “friendly URLs”, that’s where you get things like this:
This example shows:
which is the friendlier version of this monstrosity:
Even though the ID number is in there, which takes away some of the neatness, it still makes address bar look a lot more friendly for the user.
There’s benefits to SEO and such as well, but that’s not why I’m writing this.
If I’m on a PrestaShop website, chances are I’m there to fix it, not buy something, so I don’t really care for these long, wordy, but SEO and human readable URLs. What I need is lots of shortcuts. I usually know the ID number of the product or category that I want to look at, and want to get there quickly.
For the most part, a products shortcut is what I want. I need to see the product page, and I don’t care how people normally get there.
The easiest way, if the site has friendly URLs on, is to use the ID-.html trick.
Again, that’s ID, hyphen, dot, html.
This is the minimum I found to trick the friendly URL system to redirect to the full URL.
So, something like
would go to
What about when friendly URLs isn’t enabled? Or if you want to do automated testing for example. It’s sometimes more efficient and reliable, especially if you’re telling a computer to do it, to use the ugly version.
This is a bit long winded to type, but it’ll work every time as long as the product exists.
This is even easier if friendly URLs are enabled.
It’s like the above trick, but with just the hyphen.
would go to
That’s right, it’s literally just the category ID, then a hyphen. The friendly URL system takes care of the rest.
As for the ugly version, it’s similar to the one for the product:
That’s basically all there is to it. There’s probably something you can do for the CMS pages too, but I barely touch them, so haven’t really looked.
Do you have any similar tricks to get to fiddly parts of the site? Let me know! :D
If you found this helpful, buy me a coffee. ;-)