L
L
lexstile2018-04-21 01:00:43
htaccess
lexstile, 2018-04-21 01:00:43

How to correctly generate a dynamic url for pages?

There are entries in the database with {user-id}
Now I can access /core/user.php?user_id=1234 and get the data of the user with id=1234.
Question: how can I make the pages look like: site.ru/user/1234/
What do I need to write in htaccess for this?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry, 2018-04-21
@lexstile

RewriteEngine on
RewriteRule ^user/([0-9]+)/?$ core/user.php?user_Id=$1 [L]

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question