Skip to content
WJunction - Webmaster Forum

Redirect url compatible with download managers

Status
Not open for further replies.

Nan0

Active Member
65
2011
1
Hey guys, I'm working on a custom link shortening, similar to tinyurl. Is made in php
My problem is that I do the redirect does not support download managers.
When I add the short link to any download manager, the long url is not recognized.
This is how I do the redirect:


.htaccess:
PHP:
RewriteEngine On
RewriteRule ^([0-9a-zA-Z]+)$ index.php?id=$1
index.php:
PHP:
<?php
    //$url ; get long url from database based in id
    $url = 'http://www.megaupload.com/?d=H4N9E047';
    header( "HTTP/1.1 302 Found" );
    header( 'Location: '.$url.''  );
    exit;
?>
I've also tried as follows:
index.php:
PHP:
<?php
//$url ; get long url from database based in id
$url = 'http://www.megaupload.com/?d=H4N9E047';
header( "HTTP/1.1 301 Moved Permanently" );
header( 'Location: '.$url.''  );
exit;
?>
any idea?
Thanks for your time.
 

3 comments

Your php code is fine.
Test your response header by calling the url with curl

Code:
curl -I http://your.url
 
Status
Not open for further replies.

About the author

N
Active Member · Joined
65
Messages
1
Reactions
8
Points
Grow your business

Advertise on WJunction

Connect with an established international community of webmasters, hosting providers, developers and online entrepreneurs.

  • Premium & Premium+ Sticky
  • Dedicated section banners
  • Site-wide banner advertising
Explore advertising options
Back
Top Bottom