How to hide a url like this ?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
crazytopu
Forum Contributor
Posts: 259
Joined: Fri Nov 07, 2003 12:43 pm
Location: London, UK
Contact:

How to hide a url like this ?

Post by crazytopu »

Hi,

The site I worked on is now up and running. There is just one thing bothering me a lot. You see when you click on a link, you get url something like this-


http://www.ibcs-primax.com/link.php?link_id=29

I don't want to show my users the link, how other sites hide this?

Also, is it possible that you use PHP to create and display your links on-the-fly but visitors will see them as .htm file and not .php file? I guess, i have seen some sites doing so, so just wondering how do they do that.

Many thanks
User avatar
anjanesh
DevNet Resident
Posts: 1679
Joined: Sat Dec 06, 2003 9:52 pm
Location: Mumbai, India

Post by anjanesh »

You could hide the link in the browser's url using Apache's mode_rewrite : http://httpd.apache.org/docs/mod/mod_rewrite.html

But the page its coming from will still have that link in the anchor (<a>) tags.
Bennettman
Forum Contributor
Posts: 130
Joined: Sat Jun 15, 2002 3:58 pm

Post by Bennettman »

It's possible to hide sent variables by putting them through POST instead of GET, but it'd require using Javascript on every single link to set form variables and submit a form, which is messy.

You can make .php appear to be .html files by using .htaccess to redirect (so if a user accesses page.html, they really access page.php):

Code: Select all

RewriteEngine on
RedirectMatch (.*)\.html$ $1.php
Post Reply