v1.0.0 PrestaShop 8.x

KS Pretty URLs

A module that removes IDs from URLs in PrestaShop 8.x

Author: KamikStudio
Updated: December 2024
License: 1 domain + dev/staging

1. Module overview

KS Pretty URLs is a professional module for PrestaShop 8.x that removes numeric identifiers (IDs) from URLs, creating clean, SEO-friendly links.

Before installation https://sklep.pl/37-nasiona https://sklep.pl/123-nawoz-azotowy.html https://sklep.pl/content/5-regulamin
After installation https://sklep.pl/nasiona https://sklep.pl/nawoz-azotowy https://sklep.pl/regulamin

2. Features

Supported entity types

Type Before After
Categories /37-nasiona /nasiona
Products /123-produkt.html /produkt
CMS pages /content/5-regulamin /regulamin
CMS categories /content/category/2-info /info
Manufacturers /manufacturer/8-bayer /brand/bayer
Suppliers /supplier/3-dostawca /supplier/dostawca
Blog (ETS Blog) /blog/12-tytul /blog/tytul

Key features

  • Automatic 301 redirects Old URLs with IDs automatically redirect to the new ones
  • Multilingual Separate pretty URLs for every language
  • Multishop Full multi-store support
  • Optional prefixes Ability to add prefixes such as /c/, /p/
  • Management panel Edit, delete and regenerate URLs
  • Redirect statistics Monitoring of old link usage
  • Automatic updates New URLs generated when an entity is saved
  • Conflict handling Automatic suffixes for duplicates

3. System requirements

Component Minimum version
PrestaShop 8.0.0
PHP 8.1
MySQL 5.7 / MariaDB 10.3

Module compatibility

✅ ETS Blog ✅ ps_facetedsearch ✅ Artistic Theme ✅ TheCheckout ✅ preorderandnotification

4. File structure

Directory structure
modules/ks_prettyurls/
├── ks_prettyurls.php          # Main module file
├── config.xml                  # XML configuration
├── LICENSE.txt                 # License
├── logo.png                    # Module logo (32x32)
├── index.php                   # Security file
│
├── classes/
│   ├── KsPrettyUrlsManager.php # URL management class
│   ├── KsTabManager.php        # KamikStudio menu class
│   └── index.php
│
├── controllers/
│   └── admin/
│       ├── AdminKsPrettyUrlsController.php
│       └── index.php
│
├── views/
│   ├── css/
│   │   ├── admin.css
│   │   └── index.php
│   └── templates/
│       └── admin/
│           └── index.php
│
├── sql/
│   └── index.php
│
├── translations/
│   └── index.php
│
└── upgrade/
    └── index.php

override/classes/
├── Link.php                    # Link generation override
└── Dispatcher.php              # Routing override

5. Installation

1

Upload the module files

Terminal / SCP
# Via SCP
scp -r ks_prettyurls/ user@server:/var/www/prestashop/modules/

# Or via FTP - upload the ks_prettyurls folder to /modules/
2

Upload the override files

Terminal
scp Link.php user@server:/var/www/prestashop/override/classes/
scp Dispatcher.php user@server:/var/www/prestashop/override/classes/
3

Clear the class cache

Terminal
rm -f /var/www/prestashop/var/cache/prod/class_index.php
rm -f /var/www/prestashop/var/cache/dev/class_index.php
4

Install the module

Admin Panel → ModulesModule Manager → Search for "KS Pretty URLs" → Install

5

Clear the PrestaShop cache

Admin Panel → Advanced ParametersPerformanceClear cache

6

Generate the URLs

Admin Panel → KamikStudioKS Pretty URLsConfigure → "Generate all URLs"

6. Configuration

Accessing the configuration

Menu: KamikStudio → KS Pretty URLs → Configure
Or: Modules → KS Pretty URLs → Configure

Entity types (enable/disable)

Option Default Description
CategoriesRemoves IDs from category URLs
ProductsRemoves IDs from product URLs
CMS pagesRemoves IDs from CMS page URLs
CMS categoriesRemoves IDs from CMS category URLs
Blog (ETS Blog)Removes IDs from blog post URLs
ManufacturersRemoves IDs from manufacturer URLs
SuppliersRemoves IDs from supplier URLs

URL prefixes (optional)

Prefixes help avoid URL conflicts between different entity types.

Prefix Default With prefix Without prefix
Categories(empty)/c/nasiona/nasiona
Products(empty)/p/nawoz/nawoz
CMS(empty)/info/regulamin/regulamin
Blogblog/blog/tytul/tytul
Recommendation: Leave the prefixes empty for clean URLs. Use prefixes only when you run into conflicts.

Redirect settings

Option Default Description
Automatic redirects✅ YesOld URLs redirect to the new ones
Redirect type301301 = permanent (SEO), 302 = temporary

7. Usage

URL management panel

Menu: KamikStudio → KS Pretty URLs

Action Description
URL listTable of all generated pretty URLs
EditManually change the pretty URL of an entity
DeleteRemove a pretty URL (the entity returns to its standard URL)
Generate categoriesGenerate URLs for categories only
Generate productsGenerate URLs for products only
Regenerate allGenerate URLs for all entities

Automatic generation

URLs are generated automatically when:

  • You create a new category/product/CMS page
  • You edit an existing entity and change its slug (link_rewrite)

Editing a URL manually

  1. Go to the URL list
  2. Click the edit icon next to the chosen entry
  3. Change the "Pretty URL" field
  4. Save
Note: When you change a URL, a redirect from the old address is created automatically.

8. Database

Table: ps_ks_pretty_urls

Stores the pretty URL → entity mapping.

SQL
CREATE TABLE `ps_ks_pretty_urls` (
    `id_pretty_url` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
    `entity_type` VARCHAR(50) NOT NULL,
    `id_entity` INT(11) UNSIGNED NOT NULL,
    `id_lang` INT(11) UNSIGNED NOT NULL,
    `id_shop` INT(11) UNSIGNED NOT NULL,
    `pretty_url` VARCHAR(255) NOT NULL,
    `original_url` VARCHAR(255) NOT NULL,
    `active` TINYINT(1) NOT NULL DEFAULT 1,
    `date_add` DATETIME NOT NULL,
    `date_upd` DATETIME NOT NULL,

    PRIMARY KEY (`id_pretty_url`),
    UNIQUE KEY `unique_pretty` (`pretty_url`, `id_lang`, `id_shop`),
    UNIQUE KEY `unique_entity` (`entity_type`, `id_entity`, `id_lang`, `id_shop`)
);

Table: ps_ks_pretty_urls_redirects

Stores redirects from the old URLs.

SQL
CREATE TABLE `ps_ks_pretty_urls_redirects` (
    `id_redirect` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
    `old_url` VARCHAR(255) NOT NULL,
    `new_url` VARCHAR(255) NOT NULL,
    `id_lang` INT(11) UNSIGNED NOT NULL,
    `id_shop` INT(11) UNSIGNED NOT NULL,
    `redirect_type` SMALLINT(3) NOT NULL DEFAULT 301,
    `hits` INT(11) UNSIGNED NOT NULL DEFAULT 0,
    `last_hit` DATETIME DEFAULT NULL,
    `active` TINYINT(1) NOT NULL DEFAULT 1,
    `date_add` DATETIME NOT NULL,

    PRIMARY KEY (`id_redirect`),
    UNIQUE KEY `unique_old_url` (`old_url`, `id_lang`, `id_shop`)
);

9. How it works

URL generation

Saving the "Nasiona" category (ID: 37, slug: nasiona)
Hook: actionObjectCategoryUpdateAfter
KsPrettyUrlsManager::generatePrettyUrl('category', 37)
Saved to ps_ks_pretty_urls + redirect

Link generation (Frontend)

$this->context->link->getCategoryLink(37)
Override: Link::getCategoryLink()
KsPrettyUrlsManager::getPrettyUrlByEntity('category', 37)
Returns: https://sklep.pl/nasiona

URL resolution (Request)

User: https://sklep.pl/nasiona
Override: Dispatcher::dispatch()
Looks up ps_ks_pretty_urls: pretty_url='nasiona'
Result: category, ID=37
PrestaShop renders the category

11. Troubleshooting

404 page after enabling the module

Cause: Missing override files or an outdated class cache.

Solution:

# Check the override files
ls -la override/classes/Link.php
ls -la override/classes/Dispatcher.php

# Delete the class cache
rm -f var/cache/prod/class_index.php
rm -f var/cache/dev/class_index.php
Links still contain IDs

Cause: The Link.php override is not working.

Solution:

// Check whether the override is loaded (temporarily in index.php)
var_dump(get_parent_class('Link'));
// Should return: "LinkCore"
Duplicate URLs

Cause: Two entities share the same slug.

Solution:

  • The module automatically adds a suffix: nasiona, nasiona-2
  • Or use prefixes: /c/nasiona, /p/nasiona
Redirects are not working

Cause: The automatic redirects option is disabled.

Solution:

  1. Go to the module configuration
  2. Enable "Automatic redirects"
  3. Select type: 301
The KamikStudio tab does not appear

Solution:

cd ~/public_html/sklep && php -r "
require 'config/config.inc.php';
require 'modules/ks_prettyurls/classes/KsTabManager.php';
KsTabManager::installTab('ks_prettyurls', 'AdminKsPrettyUrls', 'KS Pretty URLs', 'link');
echo 'Done!';
"
rm -f var/cache/prod/class_index.php

12. FAQ

Does the module affect SEO?

Yes, positively. Clean URLs are indexed better by Google. 301 redirects preserve link juice from the old addresses.

Do I have to use prefixes?

No. Prefixes are optional. Leave the fields empty for clean URLs like /nasiona.

What happens when I uninstall the module?
  • The database tables are removed
  • Redirects stop working
  • URLs return to the standard format with IDs

Recommendation: Before uninstalling, add redirects in .htaccess

Does the module work with cache?

Yes. The module is compatible with PrestaShop cache, Varnish, Cloudflare, Redis/Memcached.

How do I move the module to another server?
  1. Copy the module folder
  2. Copy the override files
  3. Export the tables: ps_ks_pretty_urls, ps_ks_pretty_urls_redirects
  4. Import them on the new server
  5. Clear the cache

13. License

KamikStudio Commercial License

License grant

The license permits installing and using the module on:

  • 1 (one) production domain
  • An unlimited number of development/testing/staging domains

Restrictions

  • Reselling, distributing or sharing the module is prohibited
  • Removing the author information is prohibited
  • Decompiling and modifying the source code for the purpose of duplication is prohibited

Support and updates

  • 12 months of free updates from the date of purchase
  • Technical support via email (response time up to 48h)

14. Changelog

1.0.0 December 2024

🎉 First production release

  • ✅ Support for categories, products, CMS, blogs, manufacturers
  • ✅ Automatic 301/302 redirects
  • ✅ Management panel in the Back Office
  • ✅ Multilingual and Multishop
  • ✅ Optional URL prefixes
  • ✅ Redirect statistics
  • ✅ Integration with the KamikStudio menu
  • ✅ Compatible with PrestaShop 8.x and PHP 8.1+

15. Support

Contact

Reporting bugs

When reporting an issue, please include:

  1. PrestaShop version
  2. PHP version
  3. Description of the problem
  4. Steps to reproduce
  5. Error logs (if any)

Paid support

We offer:

  • Module installation and configuration
  • Customization to your individual needs
  • Integration with other modules
  • Troubleshooting

Rate: €52 net / hour