Encrypt URLs

Discussion in 'Apache' started by boulay, Jun 26, 2009.

  1. #1
    Hello,

    I need to encrypt certain URLs included in the response sent to the client and generated from a PHP script (most of them are pdf files)

    For instance, the URL
    http://www.aaa.com/documents/file1/mydoc.pdf

    should become something like
    http://www.aaa.com/Ffdsf2332342342342342423

    and the other way around; a client accessing
    http://www.aaa.com/Ffdsf2332342342342342423

    should be redirected to
    http://www.aaa.com/documents/file1/mydoc.pdf

    How can I achieve this? I was thinking of using filters or mod_rewrite.

    Thanks a lot for your help
     
    boulay, Jun 26, 2009 IP
  2. coffear

    coffear Member

    Messages:
    31
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    43
    #2
    not really encrypting the data but you could for example use a random string as an access code. Have a table in the Db that shows which access keys are for what file.

    Once you have done this then simply have a htaccess file that converts access code into a variable and pass it into another file that handles the pushing of the file. This method ensures the person does not know the url of the file as they are going through a secondary file with no forwarding taking place (if you use do as you originally planned they could just look at the headers the browser receives and know the proper address)
     
    coffear, Jun 28, 2009 IP
  3. boulay

    boulay Peon

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thanks for your reply coffear. The problem is that this solution does not handle the following case...
    the URL
    http://www.aaa.com/documents/file1/mydoc.pdf

    should become something like
    http://www.aaa.com/Ffdsf2332342342342342423

    I cannot rewrite the PHP files to include the new URL; there are hundreds of them. Thats why I was thinking of creating a filter
     
    boulay, Jun 29, 2009 IP