L
L
lif5272020-08-06 21:47:28
PHP
lif527, 2020-08-06 21:47:28

For example, there is a site site/89798749, how can I make such a link (after the word site)?

another more understandable example. there is VK and there is a link to the profile https://vk.com/here id.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
Anton R., 2020-08-06
@lif527

Write a router that will parse the url and return the necessary pages depending on the content of the link.

T
ThunderCat, 2020-08-06
@ThunderCat

google: single entry point, cnc, mod_rewrite, routing.

Y
yulchurin, 2020-08-06
@yulchurin

https://stackoverflow.com/questions/19567532/tryin...
In htaccess you need to write:
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*?)/? $ index.php?id=$1 [L]
Now id should be available via $_GET['id']

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question