How to get the login value from this URL "http://atittind.16mb.com/user/login"))))))
|
2 answers
1) Remove login from $ _SERVER ['REQUEST_URI']
2) .htaccess (schematically):
RewriteEngine On RewriteBase / RewriteRule ^user/(.+) /myscript.php?action=user&login=$1
- I need to phhp - bukvoed
- See point 1. In the simplest case: $ login = str_replace ('/ user /', '', $ _SERVER ['REQUEST_URI']); - user6550
- Cheto does not come here login - bukvoed
- And no, it’s not only bre but bre / - bukvoed
- Well I wrote: "in the simplest case." In the original post there was a URL without / at the end, here is the solution for this case. Further there will be a question how to remove / in the end, I correctly guessed? - user6550
|
For example using .htaccess
In the .htaccess file, write the following:
RewriteEngine On RewriteRule ^user/(.*)$ /user/index.php?login=$1 [L]
And accordingly, in the /user/index.php file , get the login from the $ _GET ['login'] variable
- I need to php))))) - bukvoed
- this is php. Learn how to use .htaccess file - Emil Sabitov
|