Page 1 of 1

mod rewrite rule failing

Posted: Tue Sep 05, 2006 1:50 pm
by John Cartwright

Code: Select all

RewriteEngine on
      RewriteRule !\.(js|ico|gif|jpg|png|css)$ index.php
Using this rule on apache 1.3 works okay, but when I transfer this to a apache 2 server I am getting an Internal Server Error. I'm not very good at regex, and I can't quite figure out a way to replicate this rule for apache 2 compliance. Any ideas?

Also, yes, Mod rewrite is loaded as a module.

Thanks :P

Posted: Tue Sep 05, 2006 1:58 pm
by nickvd
I'm assuming that you're attempting to use clean url's on your site. I've found that the following .htaccess works like a dream.

Code: Select all

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule index.php[QSA,L]
(QSA will append the query string to the url, so $_GET will still work for legacy scripts)

Posted: Tue Sep 05, 2006 2:16 pm
by Buddha443556
I wouldn't expect a 500 from your rewrite so maybe ...
Note: Enabling rewrites in per-directory context
To enable the rewriting engine for per-directory configuration files, you need to set ``RewriteEngine On'' in these files and ``Options FollowSymLinks'' must be enabled. If your administrator has disabled override of FollowSymLinks for a user's directory, then you cannot use the rewriting engine. This restriction is needed for security reasons.
FollowSymLinks is required under both Apache 1.x and 2.