PrestaShop Unfriendly URLs as Shortcuts

PrestaShop has built in support for “friendly URLs”, that’s where you get things like this:

/12-cakes is quite friendly

This example shows:
/12-cakes
which is the friendlier version of this monstrosity:
/index.php?id_category=12&controller=category

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.

Products

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 
example.com/1234-.html 
would go to
example.com/category-name/1234-product-name.html

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.

example.com/index.php?controller=product&id_product=1234

This is a bit long winded to type, but it’ll work every time as long as the product exists.

Categories

This is even easier if friendly URLs are enabled.

It’s like the above trick, but with just the hyphen.

example.com/21-
would go to
example.com/21-awesome-category

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:

example.com/index.php?controller=category&id_category=21


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. ;-)