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?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.