.htaccess question -- redirect after allowing download?

Discussion in 'Apache' started by Crayz, Aug 6, 2007.

  1. #1
    Hello, say website A had a link to the file file.rar which was hosted on my server.

    When people click that link @ website A to download file.rar off of my server, I want to be able to allow them the download, and right after, redirecting them to a certain page.

    Is this possible & any suggestions?

    Thanks!
     
    Crayz, Aug 6, 2007 IP
  2. krt

    krt Well-Known Member

    Messages:
    829
    Likes Received:
    38
    Best Answers:
    0
    Trophy Points:
    120
    #2
    Not quite sure what you want.

    Something like http://www.songbirdnest.com/ when you click on "download" ? If so, use a JS document.location.href on window.onload which will prompt for download but keep the user on the page or an <iframe src="download url">
     
    krt, Aug 6, 2007 IP
  3. powerspike

    powerspike Peon

    Messages:
    312
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    0
    #3
    htaccess engages the request before it is processed by your application/server

    ie
    client request -> htaccess -> request process

    what you would need to do, is to direct the person to the page, and then trigger the download.

    you could redirect the file request to a page, and pass the filename onto the script to trigger the download, that would be the best way you could do it from the information you have supplied.
     
    powerspike, Aug 6, 2007 IP
  4. Crayz

    Crayz Well-Known Member

    Messages:
    708
    Likes Received:
    9
    Best Answers:
    1
    Trophy Points:
    120
    #4
    How would I redirect on file request?

    Have any links which may help?

    Thanks!
     
    Crayz, Aug 9, 2007 IP