[thelist] mod_rewrite regex help

Matt Warden mwarden at gmail.com
Mon Dec 20 19:13:21 CST 2004


Hello list,

I have the following rules in my .htaccess file:

RewriteEngine On
RewriteRule ^/collab.*$ $1 [NC,L]
RewriteRule \.(php|htm|html)$ /server.php?q=$1 [NC,L]
RewriteRule ^[^\.]*$ /server.php?q=$1 [L]

This is what I'm trying to do:
1. Allow any request to the /collab directory to pass through
2. Catch all requests that do not match #1 and have the form *.php
*.htm or *.html and pass them to server.php. An example would be a
request for /foo/bar/page.htm rewritten to
/server.php?q=/foo/bar/page.htm
3. Catch all requests that don't have a dot in them and pass them likewise.

#3 was an attempt to match requests for the default page of the root
and other directories. FIrst, I'm sure there is a better way to do
that. ideas?

But, my main question has to do with th is just not working at all. I
tested my regex's and they seem to match correctly, but I am getting
500 errors in the apache logs when I test things. For example:

... "GET /blah HTTP/1.1" 500 - "-" "Mozilla/5.0 (X11; U; Linux i686;
en-US; rv:1.6) Gecko/20040301 Firefox/0.8"

and

... "GET /blah.htm HTTP/1.1" 500 - "-" "Mozilla/5.0 (X11; U; Linux
i686; en-US; rv:1.6) Gecko/20040301 Firefox/0.8"

Thanks for any help you can offer.

-- 
Matt Warden
Miami University
Oxford, OH
http://mattwarden.com


This email proudly and graciously contributes to entropy.


More information about the thelist mailing list