Welcome to MobyThreads.com!
FAQFAQ      ProfileProfile    Private MessagesPrivate Messages   Log inLog in
All support for the MobyThreads Threaded phpBB MOD can now be found on welsolutions at this forum

Custom auto indexing

 
   Web Hosting and Web Master Forums (Home) -> Apache RSS
Next:  SSL authentification with Directory  
Author Message
bmearns

External


Since: Oct 28, 2006
Posts: 3



(Msg. 1) Posted: Mon Oct 30, 2006 4:41 pm
Post subject: Custom auto indexing
Archived from groups: alt>apache>configuration (more info?)

I want to make a custom auto-indexing script for use as the default for
my webserver. I know I can assign a non-relative path for my
DirectoryIndex, like:
DirectoryIndex /scripts/custom_index.php

And I've dont this, and it works, but there's major problems: How do I
know what directory it's supposed to be, and how do I get access to all
the Apache auto-index settings?

So for the first problem, I know I can get the URL easily enough (from
the $_SERVER super global in the PHP case), but that doesn't help me
much if it's subject to RewriteRules. Is there any easy way to either,
get the actual target directory, or feed the path backwards through the
rewrite rules?

Second issue; specifically what I'm referring to are all the directives
in mod_autoindex, like associating icons and descriptions with specific
types, and things like this. Is there a way for me to access these
settings for use in my script?

Help is much appreciated. Thanks

-Brian

 >> Stay informed about: Custom auto indexing 
Back to top
Login to vote
bmearns

External


Since: Oct 28, 2006
Posts: 3



(Msg. 2) Posted: Mon Oct 30, 2006 5:19 pm
Post subject: Re: Custom auto indexing [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

I misspoke the first time; wasn't thinking enough. What I actually
need, in terms of knowing the correct directory, is to actually feed
the url I've got through the rewrite engine.

-Brian

 >> Stay informed about: Custom auto indexing 
Back to top
Login to vote
shimmyshack

External


Since: Dec 08, 2006
Posts: 274



(Msg. 3) Posted: Mon Oct 30, 2006 6:11 pm
Post subject: Re: Custom auto indexing [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

The docs have a great example - dynamically generate the content if the
index.html file is not present or has 0 btes, be sure to set the mime
type to x-application-php or whatever it is in the php handler for your
server.

On-the-fly Content-Regeneration:
http://httpd.apache.org/docs/2.2/rewrite/rewrite_guide_advanced.html
where you pass the ${SCRIPT_URL} through in the query string to the cgi
(or php script)

As for the icons etc.. they are served by default from a site wide
alias
/icons/
so youre safe there,

and if you need to bind any more icons to strange files types, use an
..htaccess file in root, or for perfermance put them into the server
config:

here is an example from a custom index .htaccess I use:

Options +Indexes -Includes
HeaderName HEADER.html
ReadmeName README.html
AddIcon (cdISO,/apache_icons/cd_rom.png) memtest.iso
AddIcon (MSI,/apache_icons/msi.png) .msi
AddIcon (Archive,/apache_icons/compressed.png) .7z .tar .bz .bz2
AddIcon (Extension,/apache_icons/firefox.png) .xpi
AddIcon (AntiVirus,/apache_icons/bomb.png) .ref
AddIcon (HOSTS,/apache_icons/world1.png) HOSTS
IndexOptions +FancyIndexing -IconsAreLinks +FoldersFirst +NameWidth=*
+IgnoreCase +SuppressDescription +SuppressHTMLPreamble
IndexIgnore *.js *.php *.jpg *.gif *.pdf .. HEADER* README*


be careful to control who has access to the index.html, see you /could/
just create a custom 403 page, then you can use env vars like normal to
capture what was requested, you could then control whether the 403 page
resulted in an 403 header and subsequent error page, or whether it just
sent the index for that directory and status 200 based on a small php
whitelist array, I would use apache, however the php whitelist custom
403 thingy works too, provided you override the headers.
 >> Stay informed about: Custom auto indexing 
Back to top
Login to vote
Display posts from previous:   
Related Topics:
Indexing - Hi I have a small problem. I have a new Apache Server, running on Suse Linux 9.2, Apache Version 2.0.50. What is my problem: I like to access some files with the option "indexing" and this works fine except, there is now Icon to go up in th...

auto deny - Is there a way to auto deny anyone that is silly enought to type in ...%255 etc>? Getting tired of this bs.

auto index - Hi, i'm trying to get auto index working on a directory. But for some reason it's not working. IndexOptions doesn't appear in the "list available configuration directives (-L)" of apache2ctl, which I think is a little suspect.. but i'm not ...

auto index - Hi, i'm trying to get auto index working on a directory. But for some reason it's not working. IndexOptions doesn't appear in the "list available configuration directives (-L)" of apache2ctl, which I think is a little suspect.. but i'm not ...

Apache not Auto starting - A newbie question I'm afraid. I have Apache set to run on Win XP as and Automatic Startup Service, but only the Monitor starts. I have to start it manually. Once started, it works fine. Very glad for any help please. -Gen
   Web Hosting and Web Master Forums (Home) -> Apache All times are: Pacific Time (US & Canada) (change)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum



[ Contact us | Terms of Service/Privacy Policy ]