Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hiding files

Status
Not open for further replies.

infocusweb

Technical User
Jan 8, 2001
17
0
0
US
I am creating trouble shooting pages on a site. I would like to be able to direct a user to one page in the directory, but keep all other pages in that directory hidden. Can anyone recommend a solution. Thanks.
 
Hey Novonod,

Web servers are usually configured with a default document which means if you request a location containing just a directory, the will return the document instead of the directory contents. If you linked to "/docs/" and there was an index.html file in this directory, the visitor would see this instead of all the documents inside the directory (assuming index.html is the default). You could then put all of your documents in this directory and link to them individually but visitors wouldn't be able to see them because of the default document. They would have to know the specific url to view a page.

There are better ways to do this with scripting lanugages like CF but you can "hide" the files with just a default document.

Hope this helps,
GJ
 
Thanks GJ,
I had been considering doing that, but I was hoping there would be better way because it would be alot of differently named files for my client to keep track of. (They will be the one's referring the user to troubleshooting page.) So I'm trying to make it a simple directory structure for them while preventing a user from guessing what another page in that directory might be named. Know what I mean? I'm not sure I'm making sense.
Like: site.com/troubleshooting/page4.cfm
or
site.com/troubleshooting/memory.cfm
I want to avoid these if I can, but I don't want to make the path too difficult or random as to confuse the administrator. You mentioned a better way using CF. Can you give me an idea. Thanks again.
 
One way you could do it with CF is to create a database containing the names of the real files along with a random name such as &quot;Page348df&quot;. You could have the administrator set the links to &quot;/docs/index.cfm?page=page348df&quot; so that it passes the random name to the index.cfm script. Inside index.cfm, the code would look up &quot;page348d&quot; in the database, retrieve the actual file name, use <cffile> to read in the contents of the file, and then display it with <cfoutput>#cffile.filecontents#</cfoutput>. This way, there is only one link and the random code dictates what page actually gets displayed. The administrator could make up arbitrary codes and use these in any links on the site.

There might be a better way but this is the way I would probably do it,
GJ
 
Gj,

That's exactly it! Thanks, I appreciate your help! This is my first CF application, and i knew there was a way that I wasn't thinking of and this is it. Thank you.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top