Jump to content

redirect to script how to get parent... hard to explain please read


doa24uk

Recommended Posts

Hi guys,

 

Ok here's the deal. I've set up my htaccess so that any file requests to the 'files' folder with teh extension .txt or .txt2 get redirected to the script dl.php

 

RewriteEngine on
RewriteRule (.*)(txt|txt2)$ /files/dl.php [QSA]

 

Thats working fine, now I need my dl.php to print out the filename the request came from. For example test.txt

 

I can't figure out which variable to use - PHP_SELF prints '/files/dl.php' and HTTP_REFERER prints nothing.

 

Anyone figure this out?

Why not force all links to contain the get variable of the current page/previous pages  as need, then you have the route they took to get there, however this won't work for a direct linking in.

 

such as

 

a href="page.php?refer=<?php echo$_SERVER['self';?>

 

so when they click it has the page they came from on it.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.