hide the scripts name from the url bar

Not for 'how-to' coding questions but PHP theory instead, this forum is here for those of us who wish to learn about design aspects of programming with PHP.

Moderator: General Moderators

Post Reply
mcog_esteban
Forum Contributor
Posts: 127
Joined: Tue Dec 30, 2003 3:28 pm

hide the scripts name from the url bar

Post by mcog_esteban »

hi all...
how can i hide the scripts name in the url bar?
i'm not using frames.

thanks
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

there's mod_rewrite, along with interfacing scripts that take a control from the url to tell it which file to include. Note: do not use the filename/path as a control.

Code: Select all

<?php

$controls = array('jane'=>'data/jane.php', 'foo'=>'bar.php',);

if( !isset( $_GET&#1111;'control'] ) || !isset( $controls&#1111;strtolower($_GET&#1111;'control'])] )
  $control = 'jane'; // default action
else
  $control = $_GET&#1111;'control'];

$control = $controls&#1111;$control];

include($control);
use an htaccess file, or equivalent, to lock out external access to the "data" folder, if you use one, in case someone tries to guesses the path.. :)
mcog_esteban
Forum Contributor
Posts: 127
Joined: Tue Dec 30, 2003 3:28 pm

Post by mcog_esteban »

thanks feyd.
i thought that was some more intrinsic solution.
Post Reply