Score:0

Apache2 mod_autoindex IndexStyleSheet Directive not applying CSS within mod_userdir directories

lr flag

I am using mod_userdir to share files using mod_autoindex to generate a directory index for people to browse and access them, and due to the retina burning nature of the default CSS I wish to rework the CSS to something darker. While I can do this with my README for each page, I would prefer to not need to include a README for each directory.

This is the css I used for style in my README.html, where it works fine, and what I copy pasted it into a style.css file.

body {
    background-color: black;
    color: white;
}

a:link {
    color: green;
}

a:visited {
    color: yellow;
}

a:hover {
    color: red;
}

a:active {
    color: red;
}

And here is my .htaccess file contents.

IndexOptions FancyIndexing HTMLTable FoldersFirst IgnoreCase SuppressDescription SuppressHTMLPreamble SuppressLastModified VersionSort SuppressColumnSorting IconsAreLinks NameWidth=30
IndexStyleSheet "/style.css" 

I have tried putting an absolute path to my style.css as IndexStyleSheet "/home/user/public_html". I have also tried moving the file to /home/user/public_html/css and copying the example from the documentation found here: https://httpd.apache.org/docs/trunk/mod/mod_autoindex.html#indexstylesheet

Score:0
lr flag

Ok, so I FINALLY solved it myself and will include the solution for anyone who has this issue in the future:

In .htaccess I made the following change:

Line 2 IndexStyleSheet "/style.css" changed to IndexStyleSheet "/~<username>/style.css"

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.