Math Jazz — Mathias Bynens’s shizzle, y’all



Note: This site might seem inactive… That’s because it is. Don’t worry though, I’m still coding webpages and stuff! If you’re interested, I suggest you get a translator and head over to Qiwi; or you could just check the latest site we’ve been working on: Optiek Ockerman Dendermonde. Enjoy! Also be sure to check out MacKeys, a tool to convert MacBook keyboard keys to their single-Unicode-character equivalents. It comes with a QWERTY MacBook keyboard in CSS3, so it’s officially cool.

Apache: Problems using MultiViews

I just had to set up an Apache server for a school project. Because I like to use .htaccess files to set rewrite rules and fiddle with some other options, some extra modules had to be loaded in addition to the standard batch.

Checking which modules are currently loaded can easily be done using phpinfo(), as explained in this post about enabling mod_rewrite in Apache.

Activating Apache modules is easy: simply open up the httpd.conf file in the /conf/ folder of your Apache installation, and uncomment (or add) the appropriate lines. Commented lines always start with a hash (#).
Basically, to load mod_negotiation (for MultiViews) and mod_rewrite (for rewrite rules), you simply add the following lines to httpd.conf:

LoadModule negotiation_module modules/mod_negotiation.so
LoadModule rewrite_module modules/mod_rewrite.so

So far, so good. Apache is instructed to load the extra modules; we should now be able to use MultiViews and rewrite rules by defining them in a .htaccess file.
However, when I tried using Options +MultiViews, all I got was one of those infamous “500 Internal Server Error” pages.

The error log said something among the lines of .htaccess: Option MultiViews not allowed here.

Google wasn’t really helpful in this case. At first, all I could find was some guy having the same problem. I couldn’t find any solutions until I actually started browsing old #apache IRC logs.

Apache has a default setting in httpd.conf which specifies the settings that can be overriden by what’s written in your .htaccess file: AllowOverride. Your httpd.conf might contain something like this:

<Directory />
 Options FollowSymLinks
 AllowOverride All
 Order deny,allow
 Deny from all
</Directory>

Contrary to what you may think, the All parameter doesn’t really mean “[allow overriding] all options”, since it doesn’t include the MultiViews option! The key here is to use AllowOverride Options=All,MultiViews. Together with all other groupings of directives, this is the code we need:

AllowOverride AuthConfig FileInfo Indexes Limit Options=All,MultiViews

Consider this post a “note to self” kind of entry.

Filed under PHP · March 10th, 2009

Comments (2)

Listed below are the responses for this entry.

You can leave a response, or trackback from your own site.
  1. Krijn:
    This commenter’s Gravatar

    A “note to self” as in “need to blog more often”? ;)

    Comment posted on March 21st, 2009 @ 9:23 pm
  2. Phoenix Social Marketing:
    This commenter’s Gravatar

    oh .htaccess gives me headaches! I love what we can do with it but I’m wearing a groove in my head with all my scratching.

    Blogs are the best for “notes to self”!

    Comment posted on July 11th, 2009 @ 12:00 am

Leave a comment

Got something to say? Feel free to leave a comment. Some XHTML is allowed. <a href="" hreflang="" title="" rel="" xml:lang=""> <abbr title="" xml:lang=""> <acronym title="" xml:lang=""> <blockquote cite="" xml:lang=""> <br> <code> <pre> <var> <samp> <kbd> <dfn> <cite xml:lang=""> <del datetime=""> <dd> <dl> <dt> <em> <ins datetime="" cite=""> <ol> <ul> <li> <p xml:lang=""> <strong> <sub> <sup> <q cite="" xml:lang="">

Your details and your comment

Note: Comment moderation is currently enabled, so there may be a delay between when you post your comment and when it shows up. Patience is a virtue; there’s no need to resubmit your comment.