How to use htaccess to point to a different directory?

A php script where you can view a directory, but only open one file?

  • Hiya, I have a website, i am familiar with PHP, HTML5, and a little perl and Asp. This is a problem i cant seem to figure out. I have a directory of files, i want people i give the link to, to be able to view the entire directory, but if they choose to download a file, only one will download, if they try another it says session expired. Ive tried with the basic .htaccess but its not advanced enough. I am guessing this will require mysql, which is fine. If anyone could point me in the right direction, i would be very grateful. Cheers

  • Answer:

    MySQL is only going to work if these files are stored in a database. If they are, create an authorised page that displays an html form where the list of files in the database is shown via a select statement. Set the form so that only one option can be selected. On click, this can take them to a second page where the download starts and the session is destroyed. If they are just viewing the list of files in a directory uploaded to a host then you can alter the file permissions. However, this will not allow them to chose the one to download, you will have to decide.

Kay S at Yahoo! Answers Visit the source

Was this solution helpful to you?

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.