简体   繁体   中英

how to hide parameter from url

I have this url:
http://localhost:8080/cgi-bin/gestionale/dashboard.pl?user=santaclaus
My question is how to convert this:
http://localhost:8080/cgi-bin/gestionale/dashboard.pl?user=santaclaus
in
http://localhost:8080/cgi-bin/gestionale/dashboard.pl

I can modify with rewrite rule on my .htaccess file? If the Answer is yes please explain me how to do.

for security reasons i need to hide the username. If i change the username santaclaus with another user i access in her data

Hiding the username won't help you. You still need to determine what username to use in your code, and if it comes from the browser then the operator of the browser can change it.

Since you said "with another user", you must have some kind of login system in place. You have to use that.

There are two approaches you could take:

  1. Don't put the username in the URL in the first place. Read it from whatever login system you have with your server side code.
  2. Put the username in the URL and have your server side code check to see if the currently logged in user is authorised to access the requested user.

Option 2 is more complex, but allows for admin users to access other users.

There are two types of http request. GET and POST. here you are making GET http request. so your request parameters are visible in the url. To hide it you must use POST. check more details here ' http://www.w3schools.com/tags/ref_httpmethods.asp "

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM