I have an htaccess file that starts out like:
RewriteEngine On
RewriteBase /
RewriteCond %{QUERY_STRING} where-can-i-find-information-about-homer-training
RewriteRule ^(.*)$ http://usersupport.homerenergy.com/customer/en/portal/articles/2186858-where-can-i-find-information-about-homer-training-? [R=301,L]
RewriteCond %{QUERY_STRING} is-homer-pro-conservative-in-its-predictions
RewriteRule ^(.*)$ http://usersupport.homerenergy.com/customer/en/portal/articles/2186859-is-homer-pro-conservative-in-its-predictions-? [R=301,L]
...
which goes on for 308 more similar rules. As you can see, this is meant to redirect a list of articles from one site to another, where the matching element is the article name in the query part of the GET string.
If I just put in one or two of the pairs of RewriteCond
/RewriteRule
s in the file, this works. But when I use the entire file, I get a 500 Internal Server Error.
Evidently, one of the rules is causing the error, but scanning the file I cannot see which it is.
Looking at the error log, I can see a message like this:
/var/www/html/.htaccess: RewriteCond: bad argument line '%{QUERY_STRING}'
which does not tell me much.
How can I tell which rule is causing this error?