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 8523903
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T07:32:31+00:00 2026-06-11T07:32:31+00:00

I have an executable hosted at code.google.com (say, http://code.google.com/fold/file1.exe ). When the user browses

  • 0

I have an executable hosted at code.google.com (say, http://code.google.com/fold/file1.exe). When the user browses to http://mysite.com/download.exe, I want them to automatically get the content of the file http://code.google.com/fold/file1.exe without any redirect. The user should think that he/she is downloading the file from http://mysite.com/download.exe not http://code.google.com/fold/file1.exe.

How might I do this, using PHP? Is there any special term for this process?

  • 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-06-11T07:32:32+00:00Added an answer on June 11, 2026 at 7:32 am

    You can use URL rewriting to pass in the file name as an argument to a script. Your script (downloadexecutable.php in this example) would respond to a $_GET argument ‘q’ which would contain ‘download’:

    <?php
    if (isset($_GET['q']) && $_GET['q'] == "download") {
        //you will want to:
        //1) set Content-type to be the correct type...I just set it to octet-stream because I'm not sure what it should be
        header('Pragma: public');   // required
        header('Expires: 0');       // no cache
        header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
        header('Cache-Control: private',false);
        header('Content-Type: application/octet-stream');
        header('Content-Disposition: attachment; filename="'.basename('http://code.google.com/fold/file1.exe').'"');
        header('Content-Transfer-Encoding: binary');
        header('Content-Length: '.filesize('http://code.google.com/fold/file1.exe'));    // provide file size
        echo file_get_contents('http://code.google.com/fold/file1.exe');      // push it out
        exit()
    }
    ?>
    

    Then, you would enable URL rewriting on Apache in an .htaccess file in your root directory like so:

    RewriteEngine On
    RewriteRule ^(.+)\.exe$ /downloadexecutable.php?q=$1 [NC,L]
    

    When the user requests any file ending in .exe, downloadexecutable.php should be executed as follows:

    Request: http://yoursite.com/download.exe

    What actually gets processed by PHP: http://yoursite.com/downloadexecutable.php?q=download

    Request: http://yoursite.com/this/could/be/a/bug.exe

    Processed: http://yoursite.com/downloadexecutable.php?q=this/could/be/a/bug

    Obviously it would need a bit of work and I haven’t tested any of the above, but if you fool around with it a bit and are willing to use google, you should be able to get it working.

    URL Rewriting tutorial: http://www.addedbytes.com/articles/for-beginners/url-rewriting-for-beginners/

    Source for the php stuff: http://snipplr.com/view/22546/

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

Sidebar

Related Questions

I have an executable (say notepad.exe). I am trying to create a function map
I have a executable jar file and i want to see code behind it.
Assume I have an executable called 'exe' which spawns a child process. This child
Lets say that I have an executable and when it is started I want
I have a server executable that talks to Active Directory to retrieve user information.
I have to generate an executable (.exe) file from my python program. I would
I have an executable name, like cmd.exe and need to resolve its fully-qualified path.
I have an executable file (program.exe) That is virus infected. Is there any possible
If I have an executable out.exe and it's stdout is redirected to a file,
I have an executable which is hosted on a server and can be launched

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.