Frage

I seem to have a problem which I've been struggling to solve. I'd love a bit of help here. I have a dump site where I am using mod_autoindex and FancyIndexing.

I have my FancyIndexing icons defined in my .htaccess file. I also use mod_rewrite to pass the files through several php scripts (depending on the file extension).

Everything works great, except when a file extension is matched on a RewriteRule, Apache displays only it's default icon, and not the one specified.

All FancyIndexing resources are on the /imgindex directory, and all viewers are on the /viewers directory.

This is the relevant part of the .htaccess file (I'm currently tweaking it, so it's not optimized):

Options +Indexes
IndexOptions +XHTML +HTMLTable +FancyIndexing +FoldersFirst +SuppressHTMLPreamble +IconsAreLinks +IgnoreCase +NameWidth=*
IndexIgnore *~ imgindex viewers favicon.ico
HeaderName /imgindex/header.html
ReadmeName /imgindex/footer.html

# ------ Fancy Indexing ----------
AddIcon /imgindex/image.png .jpg .jp2 .jif .jpeg .tiff .tif .pict .pct .bmp .gif .png .psd .tga .ai .indd .fh* .fh10 .xcf .svg
AddIcon /imgindex/app.png .app
AddIcon /imgindex/movie.png .mov .mpg .mpeg .m2v .avi .divx .xvid .swf .wmv .wma .wm* .ram .rm .ogm .ogv
AddIcon /imgindex/txt.png .txt .text .log
# etc, etc.
DefaultIcon /imgindex/text.png

# ------ Rewriting --------
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} -f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !^viewers/(.*)$
RewriteCond %{REQUEST_URI} !^imgindex/(.*)$
RewriteRule ^(.*).(css|cs|cpp|h|hpp|pas|xml|js|asm|inc|as|sh|bat|cmd|html)$ /viewers/view_source.php?file=$1.$2&%{QUERY_STRING} [NC,L]

RewriteCond %{REQUEST_FILENAME} -f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !^viewers/(.*)$
RewriteCond %{REQUEST_URI} !^imgindex/(.*)$
RewriteRule ^(.*).(jpg)$ /viewers/viewjpg.php?file=$1.$2&%{QUERY_STRING} [NC,L]

# (etc, etc.)

As I said, everything seems to work great, except for the icons. In the case above, all .css, .cs, .cpp, (etc), and all .jpg files will use the icon defined in DefaultIcon, instead of the one for its filetype (defined in AddIcon).

If I remove the RewriteRule that matches that filetype, the correct icon gets displayed.

Is this normal, expected behaviour? Any way to override it, if so?

Regards,

Keine korrekte Lösung

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top