Hide the page info in URL

Posted by Vinokanna under ASP.NET on 10/4/2013 | Points: 10 | Views : 1560 | Status : [Member] | Replies : 1
How to hide the page information in URL,

Any one knows please help thanks in advance


Posted by: Kmandapalli on: 10/4/2013 [Member] Silver | Points: 25


The short answer is no, absolutely not. You must use a url that points to the page so removing that would lock all users to the homepage.

The long answer is that you can work around this some and perhaps improve the look of the url.

There are four possible ways to approach it:

1. Attempt to use javascript to hide the url or display another address. This is all but impossible and even if it worked (hiding, not changing--that's impossible), then it would be very unreliable and only work in a few browsers.
Don't bother with this.

2. Use frames. This is an easy way to display the url of the homepage (or any page you'd like) that then contains a frame with the actual store or whatever else you'd like to display. The user can find the url being requested, but it won't be displayed anywhere directly.
Frames are bad for a few reasons, though, so this is not an ideal solution.

3. Use .htaccess (mod_rewrite) to dynamically change the url:
this is similar to PHP, but a little more complex to use. Basically it lets you program the server to take incoming requests of one sort and display pages of another sort based on rules. For example, you could replace all "1"s with "2"s in your urls:
request: /page1.htm
actual page served: /page2.htm
the URL will read: /page1.htm
And in this case "page1.htm" does not need to exist-- the server will just pretend that it does.
So this could create a simplified url as well.
But still like PHP above it's not possible to use this to hide the location so that people can't access it again.

None of these methods can be used to "secure" the URL, just to change it.

There is one final way you could consider, but be aware that this would be hard to setup (both programming and mostly logic), and it would limit users, for example in hitting the back button or reloading the page (possibly).

Instead of using links on your website, use forms. This doesn't mean it can't be still "link" graphics (text that submits a form) or even that they need to fill in information in a form, but that instead you will have them actual submit data (behind the scenes) to the server.
Then after this, the data can be stored in a session or cookie variable and you can act on that rather than on the URL.
So to choose a product submit a form for that product. Then the SAME page loads, but since there is now post variable information that helps the server know what to do, the page will then display information about the product. If refreshed, the data can then have been stored in a session variable, you can do the same, etc.
It's a very complex process and annoying because if someone bookmarks a product and returns at a later time they will instead get your homepage.

So the bottom line is that your customer doesn't know enough about web design or web customers to understand that this is a terrible idea. Can you "do" it? No. Can you kinda "do" it and make it somewhat effective while not solving everything and possibly being awkward for the user? Yes.
The simpler answer may be to simply rename all the folders to something shorter so the URL doesn't look as bulky. There's nothing wrong with doing that (but also no gain for 'security').

Mark as answer if satisfied...

Shree M.

Kavya Shree Mandapalli

Vinokanna, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response