Forum Moderators: phranque
My RewriteRule .* - [G] makes the server look for a custom 410 error document (which I did not have) causing a loop (that is what they called it) resulting in a (single) 500 error in my log.
Must these lines be put before the www/non-www canonicalisation and hotlinking protection?
Just to clarify one point... the "G" flag makes the server respond with a 410 status (as keyplyr states). It does not necessarily make the server look for a custom 410 error document,
Only if the ErrorDocument directive is present and pointing to a non-existent file could a "G" flag result in a 500 error - but this isn't a "loop".
However, if you did have a custom 410 error document defined (although you say you didn't)
The error log should have more detail as to the nature of the 500 error.
In addition it does not always function for referrer spam.
RewriteCond %{HTTP_REFERER} pizza\-xxxxx\.xxx
RewriteRule !^410\.html - [G]
may result in:
"GET / HTTP/1.1" 301 242 "http://pizza-
and then
"GET /410.html HTTP/1.1" 200 294 "http://pizza-
I.e. a successful request by pizza-xxxxx for 410.html is logged.
Neither does it always work for IPs blocked by {REMOTE_ADDR}
"GET /robots.txt HTTP/1.1" 301
"GET /410.html HTTP/1.1" 200 Your using these in a non-traditional method.wilderness I believe thord is just giving examples here.
Try moving a few lower in your htaccess, that is below the domain canonicalisation.
Ordering of directives only matters within any one mod. Otherwise, put things in whatever order is simplest and most convenient for you.
410's are always after canonicalisation
RewriteRule ^{all-your-named-error-documents} - [L]