Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

In Apache, is there any way (using scripts like CGI and PHP, etc.) that will fetch all static content (html, images, and files within a specified size range) and send it to the user as a randomized link, set with a (30 minute for example) expiration? This would preferably not use mod_proxy or it's reverse, as all files will be on the same server. I'm just trying to learn, for a reasonable way to make something like this: http://www.example.com/09-21-2011/USA/CA/article-name.html to appear as http://www.example.com/09-21-2011/USA/CA/randomnumbersandletters (with no .html). I realize the html part can be fixed easily with mod_rewrite.

Any help on this would be much appreciated.

There is an example of this working here: http://memory.loc.gov/frd/cs/httoc.html Click on any of the links to a section of the article, scroll to the bottom of that page.

Says this:

Do NOT bookmark these search results.

Search results are stored in a TEMPORARY file for display purposes. 
The temporary file will be purged from our system in a few hours.

Links as this:

.../cgi-bin/query/r?randomnumbersandletters

Optional function would be to store the temporary sessions in a SQL database and include user IP and time/date accessed.

share|improve this question

closed as off topic by voretaq7, Ward, John Gardeniers, Iain, Scott Pack Sep 22 '11 at 11:29

Questions on Server Fault are expected to relate to professional server, networking, or related infrastructure administration within the scope defined by the community. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about reopening questions here.If this question can be reworded to fit the rules in the help center, please edit the question.

    
This is a terrible idea unless you're also using robots.txt to disallow indexing as it will utterly destroy search engine results... –  voretaq7 Sep 21 '11 at 21:41
    
I planned on doing exactly that but thanks. –  U4iK_HaZe Sep 21 '11 at 21:59
add comment

1 Answer

up vote 2 down vote accepted

This isn't a system administration problem, it's a programming problem.


A quick, ghetto solution algorithm:

  1. Establish a session
  2. When accessing a page encode some representation of that session along with some representation of the page requested in the URL bar
  3. If the session for accessing a document is expired or accessed from an invalid host deny the request

An equally ghetto solution for something like memory.loc.gov (which is actually pulling that data from a separate server and storing it in a temporary location)

  1. Establish a session
  2. When a file is requested see if we already have it locally in that session's directory.
    • If we have the file, display it (redirect the user or read it in using the scripting language)
    • If we don't have the file retrieve it and stick it in the session's temporary directory, then display as above.
  3. When a session's temp directory has not been accessed for TIME_PERIOD, delete it.
share|improve this answer
    
Selected as best answer, but note: This provides no information on how to actually govern the task, much like a table of contents of a book. So, a bit vague, but gives me something to work on in the wee hours of dawn. –  U4iK_HaZe Sep 21 '11 at 22:44
    
@U4iK_HaZe: If the answer doesn't answer your question then there is no requirement to accept it. –  Iain Sep 22 '11 at 6:49
    
But it was the "best answer available" so I did. A few bonus points to voretaq7 won't even show up. –  U4iK_HaZe Sep 22 '11 at 10:18
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.