I've noticed many questions about that problem, but in my case the htaccess is very simple:
<IfModule mod_rewrite.c>
RewriteEngine on
#somecomment
RewriteBase /restAPI/
#continue if condition is true:
RewriteCond %{REQUEST_FILENAME} !-f # somecomment
RewriteCond %{REQUEST_FILENAME} !-d # somecomment
RewriteRule ^(.+)$ index.php?url=$1 [QSA,L]
#somecomment
#somecomment
</IfModule>
4-5 weeks about now I haven't problem with that rewritebase, but now I can't start my simple RestAPI :/
Any suggestions why this doesn't work?
RewriteCond %{REQUEST_FILENAME} !-f # somecomment
RewriteCond %{REQUEST_FILENAME} !-d # somecomment
The 500 Error is the result of your line-end comments. Apache does not actually support line-end comments.
Lines that begin with the hash character "#" are considered comments, and are ignored. Comments may not be included on the same line as a configuration directive.
Reference: https://httpd.apache.org/docs/2.2/configuring.html#syntax
Sometimes line-end comments appear to work because of a "fluke". If you supply all the arguments to the directive then anything trailing on the line is ignored. But in this case you have not supplied any flags (the 3rd argument), so you get the error, it is trying to interpret your # somecomment
as RewriteCond
flags.
It seems as if your comment on the lines
RewriteCond %{REQUEST_FILENAME} !-f # somecomment
RewriteCond %{REQUEST_FILENAME} !-d # somecomment
Are not interpreted as comments but as parameters to RewriteCond
. Remove those (or move them on the line above RewriteCond
).
IIRC comments are only supported at the beginning of a line in Apache httpd.