I do not like something like this: example.com/?id=2222. How to change it to example.com/2222?
example.com/?id=2222
example.com/2222
You need to look at mod_rewrite .
From the documentation: This module uses a rule-based rewrite mechanism (based on a regular expression analyzer) to rewrite requested URLs on the fly.
Thus, the URL may look like example.com/2222 to the user, but then translated to example.com/?id=2222 on the server.
Make sure it is mod_rewriteturned on and you need a few lines in the .htaccess file, similarly:
mod_rewrite
RewriteEngine on RewriteBase / RewriteRule (.*)$ index.php?id=$1 [L]
( ) "htaccess pretty urls" .
If you cannot use mod_rewrite (this is the best way), you can use the 404 trap.
That is, usually example.com/2222 will show 404 to the user. If you configured the server for the script of your choice instead of the default 404 page, now you can take the example.com/2222 URL and redirect the user to wherever you want.
Source: https://habr.com/ru/post/1734953/More articles:C ++: avoiding double maintenance in inheritance hierarchies - c ++Processing a PHP session when the same client requests the same script several times in a row - phpMinimum path - all edges at least once - algorithmКаков наилучший дизайн базы данных для нескольких таблиц с отношением 1 к одной таблице? - database-designМожно ли вставить изображение в Silverlight/Flash/JavaScript? - javascriptLinq2Sql Constructor Launches Storage Procedure Multiple Results Set as Single - c #How to force SQL Server XQUERY to return something other than "There is no element named [Element]" - sqlHow to find elements by 'id' field in SVG file using Python - pythonHow do I match a string with quotation marks followed by a string in curly braces? - javaWindows equivalent for system configuration directory - command-lineAll Articles