![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Auto copy for files from folder to folder upon instant writing | Bashar | UNIX for Advanced & Expert Users | 2 | 08-21-2008 03:44 PM |
| How to display contents of folder when 'cd' is used | mumashankar | UNIX for Dummies Questions & Answers | 3 | 03-06-2008 07:42 PM |
| Parse the .txt file for folder name and FTP to the corrsponding folder. | MeganP | Shell Programming and Scripting | 3 | 07-03-2007 02:54 PM |
| display the files in a folder which are older than 1 hour | vgs | Shell Programming and Scripting | 7 | 05-29-2007 03:05 PM |
| display the files in a folder which are older than 1 hour | vgs | UNIX for Dummies Questions & Answers | 3 | 05-25-2007 09:46 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Logic behind display of .www folder ??
Hi frns,
I have a weird quest. I want to know the logic behind the display/rendering of the directory structure when there is no "index.htm" in the .www directory of the user. The requirement of this knowledge rooted from another requirement. Let me brief it.. I want to place a "index.htm" in my .www folder, which provides some info to the visitors (some links, pics, downloads), and finally it also should provide a link to the "directory structure" which would have been displayed in case the "index.htm" was absent ! I donno if this is possible. I dont want any CGI wich transform the ls to html. Is there a straight way around for this problem? I told its 'weird' cuz, if the index.htm wasnt there, the default dir structure will be displayed.. Now since its there, it overrides the default behaviour, which i want to nullify when the user clicks on one of the links of index.htm. One can do this only if the intricacies of unix are known.. btw i am also baffled whether this listing of dir structure is done by unix or windows, cuz the browsers are run in windows environment only.. but windows displays unix dirs in a different way compared to win dirs..!! Please tell me if you dont get the question... Thanks Srini |
|
||||
|
Actually it's the web server's configuration that interprets this. Your server appears to display a directory if the default file isn't present (index.htm in this case). Mine's configured to not display the directory (you get a Forbidden error I believe).
One way would be to change the default document for your home directory so there isn't one, or that index.htm isn't one of them. Then when someone browses to your directory, they get a directory listing and they can click on the index.htm to get your index page. Plus you can force it to index.htm by giving out yoursite/index.htm. The httpd.conf file is generally owned by the web server process or by root so if you're not root, you'll need to get their ok to have it changed just for your directory. Alternately, you can have an index.php file as one of the documents and have it just whip up a quick directory listing with some data at the top welcoming folks to your site. That assumes php is installed of course. Not sure if you can do that with perl (I use php for other things so php is available to me). Carl |
|
||||
|
Hi,
Thank you for ur response. My problem is not related to webserver. Actually i am in an intranet, where in i have my own disk space of a shared network drive. In this case, i am the person who gives access to the .www dir of my home drive. Now I wanna put the index.htm in my .www dir, so that others type "http://www/~srini" to access my homepage. This home page is now the dir structure of my home directory. When i place index.htm in the .www dir, it will display the contents of index.htm. I just want to provide users a link on index.htm, which will lead them to the plain old dir structure display. What you suggested is to rename index.htm to some other file say "random.htm", so that users would by default get the dir structure, from where they can click random.htm. But i just want to do the reverse !! I wanna make users click on a link on index.htm so that they would go back to the directory structure (which cannot be done thro a link to www/~srini, because it is overridden by the placing of index.htm) ! It is really difficult to express my problem verbally ! Thanks Srini |
|
||||
|
Quote:
You won't get an http://... page, even on an intranet, without a web server answering the request when you try to load that page. All the advice given still applies. |
|
||||
|
Quote:
![]() 1. You have an HTTP accessible directory: http://www/~srini 2. When someone reaches that directory now, they get a directory list. 3. When you put index.htm into that directory, the browser loads index.htm 4. You'd like a link on your index.htm page to be able to direct the browser to http://www/~srini and present a directory listing. One question would be, how to people get to your directory in the first place? Are you giving them the URL (via e-mail or verbally) or is it a link off a Student or Office Directory (for example). If it's either of those methods, my suggestion will still work. 1. Modify your individual directory configuration in the web server configuration file to exclude index.htm from the DirectoryIndex variable (for Apache). 2. Modify the Student/Office Directory listing to include index.htm and the listing now says: Code:
<a href="http://www/~srini/index.htm">Srini's Home</a> 3. When you give out your home directory listing, make sure you include the trailing /index.htm in the URL. 4. In the index.htm, have a link that points to just your home directory: Code:
<a href="http://www/~srini/">Directory Listing</a> And that should take care of it. If you want to eliminate a few steps or are unable to modify your DirectoryIndex variable, you can simply use an alternate html file (like random.htm). Just make the same changes to the Directory listing and the URLs you provide to friends. Another option works if you have php or perl installed. I did a quick google search and found this: http://www.evoluted.net/community/co...orylisting.php With this, you can provide a very nice looking configurable directory listing through php. I haven't reviewed the code for vulnerabilities or anything so I'm not recommending that you use it, just providing it as an example of code that's already on the 'net and ready to use. (If you do decide to try it, make sure you go though the script and understand what the script is doing first so you don't leave your system open to attack.) Oh, and there certainly is a web server on your system. If you Code:
$ telnet [yourservername] 80 you might get a server signature string which will identify the server, assuming the admins haven't obfuscated it for security reasons (unlikely if they allow directory listings since that's generally considered a minor security issue). Type Code:
GET / HTTP/1.0<enter><enter> to exit out of the session. Hope that helps. Carl |
|
|||||
|
If you have access to the Apache config (or if you are allowed to use a .htaccess file), if your webserver is Apache, of course
, you can set the HeaderName directive so that it points to the html file you want. Refer to Apache.org docs to learn how to use it.mod_autoindex: http://httpd.apache.org/docs/2.0/mod...tml#headername I think other versions support this directive. |
|
||||
|
Quote:
Carl |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|