I have this very basic rewrite rule, no matter what I try, results in an Error 500.
RewriteEngine On
RewriteRule ^folder/(.*) /folder/index.php?Alias=$1 [L]
My httpd.conf file has the following content: (which seems OK to me)
<Directory "/var/www/html">
Options -Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
<IfModule mod_suphp.c>
suPHP_Engine On
suPHP_UserGroup webapps webapps
SetEnv PHP_INI_SCAN_DIR
</IfModule>
</Directory>
Any suggestions on what might be going wrong? I’ve also tried to add $ at the end of my rewrite rule.
The rewrite engine will loop repeatedly, until the URI stops changing, or the internal redirect limit is reached which causes the 500 error to be thrown. Your rule’s target URI
/folder/index.phpwill get thrown back into the rewrite engine and your same rule’s regex matches it,^folder/(.*). So you’ll need to add some kind of condition to prevent the loop.This is simple, it simply won’t apply the rule if it already starts with
/folder/index\.php. You can also try:This is a little less restrictive of a condition. It only applies the rule if the requested URI doesn’t map to an existing file or directory. This assumes that when you try to go to
/folder/blahblahthere isn’t a directory or fileblahblahand that you want to route it through your index.php.