Log in

View Full Version : redirect short url to a long url.



chetanmadaan
06-20-2011, 07:31 PM
we have a long url which we send to users in email and sometimes they have problems clicking it. so, we want to shorten the url to something in few characters.


long url: index.php?option=vm&page=downloads&product_id=6&file_name=soft.exe&id=XXXX

the XXXX will be the download id per customer.

short url: www.oursite.com/pdownload?XXXX

is there a htaccess redirect we can do here??

Thanks

bluewalrus
06-20-2011, 07:42 PM
I haven't worked with htaccess but you could use php headers

at the start of this page www.oursite.com/?pdownload=XXXX put in



<?php
if (!empty($_GET['pdownload']))
header("Location: index.php?option=vm&page=downloads&product_id=6&file_name=soft.exe&id=" . $_GET['pdownload']);
else
echo "Missing Parameter for file.";
?>

chetanmadaan
06-20-2011, 08:28 PM
THANK YOU!!! DD rocks like always.