Forum Moderators: phranque
I am looking for the following. If someone can help that would be great:
I am running a URL redirection script (freeware) which works like this -
[mydomain.com...] --> [mydomain.com...]
However, this script does not mask the URL so the address bar shows the actual URL [mydomain.com...]
How can I hide the actual file name in the browser address bar?
I have control over the source file names in videoz folder, for example, I can name it whatever I want /?1, /?AGD, /?34 etc. But I do not have control over destination file names (However it will always be alphanumeric: 45g3.html, 64j3.html, 34fg.html etc.) And the reason I don't have control over that is because there is another script being used which generates those files.
I will be creating hundreds of redirection links using the URL redirection script so is it possible to hide the actual file name using .htaccess? I do not care what's displayed in the browser address bar as long as it's not the actual file name.
Thanks for reading and I look forward to your suggestions.
$get_id = $_SERVER['QUERY_STRING'];
if ($get_id == "") {
// Include Your HTML webpage if You got one
/* E D I T T H E L I N E B E L O W I F Y O U N E E D T O */
$mainfile = "main.htm";
if (file_exists($mainfile)) {
include $mainfile;
}
} else {
if(!file_exists('config.php')) {
echo 'The file config.php is corrupt or missing!';
exit;
}
require('config.php');
$get_id = $_SERVER['QUERY_STRING'];
function hideurl_error($error){
echo $error; }
if($get_id){
$DBConn = mysql_connect($Database_Host, $Database_Username, $Database_Password) or die(hideurl_error("Could not connect to database server. Check your settings."));
$DB_DB = mysql_select_db($Database_Name, $DBConn) or die(hideurl_error("Could not connect to database ($Database_Name). Perhaps you don't have the right permissions on this DB. Check your settings"));
$sql = mysql_query("SELECT link_url,link_date,link_last FROM hideurl WHERE link_code='$get_id'");
$site_arr = mysql_fetch_array($sql);
$todaynumber = mktime(0, 0, 0, date("m"), date("d"), date("Y"));
$site_redirect = $site_arr['link_url'];
$expiry = $site_arr['link_date'];
if(($expiry <= $todaynumber) ¦¦ (!$site_arr )) {
$sqlcfg = mysql_query("SELECT cfg_notfound FROM hideurl_conf WHERE cfg_id='1'");
$nosite = mysql_fetch_array($sqlcfg);
$Not_Found = $nosite['cfg_notfound'];
header("Location: $Not_Found");
}
if(($expiry > $todaynumber) && ($site_arr )){
mysql_query("UPDATE hideurl SET link_count = link_count + 1 WHERE link_code='$get_id'");
mysql_query("UPDATE hideurl SET link_last = $todaynumber WHERE link_code='$get_id'");
header("Location: $site_redirect");
}
}
}
Once that URL is requested from your server, mod_rewrite can intercept it and send the request to any internal filepath you like.
Jim