I have a site which uses apache mod_rewrite
and has been working for the last 6 months with no error.
I have the following rewrite rule:
RewriteRule ^products/([a-z\-]+)/$ /products.php?category=$1 [NC,L]
Here is the code in my page products.php
$category = $_GET['category'];
if (isset($category)) {
// do some processing here
}
else {
header("Location: /500.html");
exit;
}
An example of a link which hits this rule is /products/lighting-poles/
Does anyone know why the actual rewrite is still occurring but not mapping the ([a-z\-]+)
to category=$1
?
Extra info
I noticed that the .htaccess
file on the host has commented out the line Options +FollowSymLinks
so I first tried to re-enable this only to have the site return an apache white screen 500
error.
More from the .htaccess file
<IfModule mod_rewrite.c>
#Options +FollowSymLinks
RewriteEngine On
RewriteBase /
# Add a trailing slash to paths without an extension
RewriteCond %{REQUEST_METHOD} !POST
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !(\.[a-zA-Z0-9]{1,5}|/)$
RewriteRule ^(.*)$ $1/ [L,R=301]
# other rules including problem rule here
</IfModule>