Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6738021
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T11:19:04+00:00 2026-05-26T11:19:04+00:00

there is a direct link for download a file. users can download that link

  • 0

there is a direct link for download a file. users can download that link after payout, like this:

http://example.com/download/webapp.rar

But I need generate ip and time limited download link to prevent leech the file with others. I want to do this without use any databases. something like this :

http://example.com/download.php?a5fds588fgdf

or

http://example.com/download/a5fds588fgdf

is there any tips?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T11:19:04+00:00Added an answer on May 26, 2026 at 11:19 am

    There is a really good nginx module doing this.

    The URL gets two parameters – Let’s call them s (security) and t (timestamp). Security is a secure hash generated from timestamp, path and a salt (in your case just add the ip).

    $ip = $_SERVER['REMOTE_ADDR'];
    $salt = 'change me cause im not secure';
    $path = '/download/webapp.rar';
    $timestamp = time() + 3600; // one hour valid
    $hash = md5($salt . $ip . $timestamp . $path); // order isn't important at all... just do the same when verifying
    $url = "http://mysite.com{$path}?s={$hash}&t={$timestamp}"; // use this as DL url
    

    To verify:

    $ip = $_SERVER['REMOTE_ADDR'];
    $salt = 'change me cause im not secure';
    $path = $_SERVER['REQUEST_URI'];
    $hashGiven = $_GET['s'];
    $timestamp = $_GET['t'];
    $hash = md5($salt . $ip . $timestamp . $path);
    if($hashGiven == $hash && $timestamp <= time()) {
        // serve file
    } else {
        die('link expired or invalid');
    }
    

    Now you just need to rewrite the downloads to this “man in the middle”-script and you are done.

    Example rewrite for nginx:

    location /download {
        rewrite ^.*$ /download.php last;
        break;
    }
    

    I’m not really familar with apache rewrites so you may check for this yourself.

    If you are using one of the following modules you do not need to verify all this yourself and it is much better performance-wise but note that it affords more configuration and sometimes another way to generate the url and hash (see module docs here).

    Or you just use the nginx secure link module: http://wiki.nginx.org/HttpSecureLinkModule

    There is also a pendant for lighty: http://redmine.lighttpd.net/wiki/1/Docs:ModSecDownload

    Or the nginx secure download module: http://wiki.nginx.org/HttpSecureDownload

    Maybe there is something for apache too… Maybe you could do something with rewrites there…

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Take a look at this URL: http://download.mozilla.org/?product=firefox-9.0.1&os=win&lang=nl It is the direct link to download
I would like to direct the user to an appropriate download link per case.
I can't download django-mssql from Google Code there doesn't seem to be a direct
Is there a direct link to download Windows PowerShell v2 (2.0) RTM? Google's first
Can anyone direct me to a link or source that outlines either in general
Just to preface my question, I understand that there is no direct support for
Is there any way I can direct display PDF files in modal boxes? I
I extended a ModelAdmin with a custom field Download file, which is a link
i want to have function like delete file from database by using link instead
How can I create a direct link to a Defect in Quality Center 10?

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.