D
D
dmitred2018-10-26 22:47:14
htaccess
dmitred, 2018-10-26 22:47:14

How to remove the .php extension and? only one link via htaccess?

Good evening, colleagues!
Not strong in Rewrite, tell me what to do?
The task is this - there is a link https://my-bot.ru/start.php?id=123456
Like it, so that it does not concern the entire site as a whole, i. the changes concerned only this link, bring it to the form
https://my-bot.ru/start/id/123456
so that the id parameter is read and it does not lead to the start/id/ directory
Thanks for the tips)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
dodo512, 2018-10-27
@dmitred

RewriteEngine On

RewriteCond %{THE_REQUEST} " /start\.php\?id=(123456) "
RewriteRule ^ https://my-bot.ru/start/id/%1? [R=301,L]

RewriteRule ^start/id/(123456)$ /start.php?id=$1 [L]

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question