Evening lads,
I'm trying to do a .htaccess redirection were all attempts to load a directory which does not exist will be redirected to a PHP script. When a directory does exist, no redirection will occur. However, when I include the code below in public_html/.htaccess file, I get HTTP 500 error.
RewriteCond %{REQUEST_URI} !-d [NC]
RewriteRule ^/(.*) /inc/test.php?id=$1 [NC,NE]
I've also tried to spell out the directories instead as shown below:
RewriteCond %{REQUEST_URI} !^/(img|imgs|about|contact|support)/ [NC]
RewriteRule ^/(.*) /inc/test.php?id=$1 [NC,NE]
But I still get a 500 error. It seems no matter what I write, if I try to negate the operation with a exclamation mark, I get thrown an error.
Any idea how to overcome this?
Cheers,
Lachlan