ravikanth
ravikanth

Reputation: 61

Encode the URL including its path in php

I want to encode the URL including its path in PHP. For eg: As of now,my path is www.yoursite.com/code/results/show.php?u=10&n="tom". I want to encode this URL so that user should not be able to see the "/code/results/show.php?u=10&n="tom". Why I need this because

  1. I do not want to expose my server data location to user
  2. Keep my server safe.

Thanks in advance.

Upvotes: 2

Views: 92

Answers (3)

rawjean
rawjean

Reputation: 51

the problem is not with url, URL should be used to only identify resource, if you want to hide something then it should not reach (be part of URL) client in the first place.

Upvotes: 0

YAMM
YAMM

Reputation: 602

best way to hide critical information is to keep it secret, instead just use a reference and get the information from the database. in general its no good sign if security depends on how user are sending requests. Sending it with POST would hide it, but not really... there are various ways to get and manipulate post-data.

Upvotes: 0

Zack Newsham
Zack Newsham

Reputation: 3002

You will need to look into .htaccess files, from there you can perform url rewrites that will take a url of (for example) www.yoursite.com/code/results/show.php?u=10&n=tom and instead output www.yoursite.com/results/10/tom.

If the u=10&n=tom is important, it can't be removed entirely from the URL, however it can be masked in the above way, the alternative is to do everything with POST, which is not a good way to go.

Take a look at this link: http://www.addedbytes.com/articles/for-beginners/url-rewriting-for-beginners/

Upvotes: 2

Related Questions