A
A
Aljo2022-03-15 12:18:35
PHP
Aljo, 2022-03-15 12:18:35

How to replace urls of all pages in a certain category with database aliases?

Hello!

There is an index.php file in the news directory.
If you go to the page with the get-parameter id, i.e. for example site.ru/news/?id=12, then information from the database about the news with id=12 will be displayed.

How can I replace all these urls with those that are recorded in the database for each news. Those. for example site.ru/news/?id=12should become site.ru/news/istoriya-companii.

As I understand it, you need to use mod_rewrite, but how to get aliases from the database?

Thanks in advance for the tips!

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Viktor Taran, 2022-03-15
@aljo222

do you need
a million CNC options
https://rio-shaman.ru/razrabotka-cms/uluchshenija/... ?

F
FanatPHP, 2022-03-15
@FanatPHP

Hint: there are approximately 100,500 answers to this question on this site.
Specifically, you don't need to receive any aliases for news.
the link should be of the form site.ru/news/12-istoriya-companii
from it you need to get only the number 12

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question