R
R
roma671772021-11-18 15:28:20
Apache HTTP Server
roma67177, 2021-11-18 15:28:20

How to write RewriteRule in .htaccess?

There is a file studentPage.phpin the root of the site

There is a
site.ru/studentPage.php?name=ivan
in
site.ru/students/ivan

the

Answer the question

In order to leave comments, you need to log in

2 answer(s)
R
Romi, 2021-11-18
@roma67177

bro, I don't remember the htaccess syntax offhand (but Google remembers 100% :) - but I want to correct your question, and maybe this will be the answer for you.
Salt here is not at all in the fact that something "turns" into something. The point here is
to redirect ANY (you can also set exceptions to the rule) requests to the web server (in your case, Apache) to studentPage.php.
- Send any request to studentPage.php
And, for example, a request comes to the server: in other words, now you have the value available inside studentPage.php through environment variables " site.ru/students/ivan" - and you can already parse it and do whatever you want with it.
site.ru/students/ivan
but the server, obeying your instructions, sends this a request to be processed by the studentPage.php file (I deliberately wildly simplify so as not to get bogged down in details)
that's the point, not the "transformations" :)
In general, the coder does not need to know this for work at all. It’s better to start learning Laravel right away - the return will be much faster than if you start digging into something that you will never use later. The era of "pure PHP" is gone forever)))

M
Maxim, 2021-11-18
@GMD

https://klondike-studio.ru/blog/snipet-for-htaccess/
https://css-tricks.com/snippets/htaccess/
As for me, a good cheat sheet

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question