D
D
DeeUs2018-02-28 11:07:03
PHP
DeeUs, 2018-02-28 11:07:03

How to make cnc for one section?

Hello!
How to properly implement cnc on the site?
there is a section on the site - a catalog of goods
there links look like:
site.ru/catalog/category/?prod_id=123
site.ru/catalog/category/subcategory/?prod_id=234
I want to do this:
site.ru/catalog/category/ alias
site.ru/catalog/category/subcategory/alias
(The alias is set through the admin panel, or it is automatically created from the name).

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Artem Soshnikov, 2018-02-28
@artem90

Use the fast router library: https://github.com/nikic/FastRoute
There, in the Usage section, there is an example of use that generally fits the requirements presented.
In addition, as of February 28, 2018, this is the fastest php router that even symfony has stuck to itself)
for htaccess you will need to add:

Options -MultiViews
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php [QSA,L]

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question