Tonight I upgraded my VPS from Ubuntu 16.04 LTS to Ubuntu 18.04 LTS. Everything worked as expected, had a little cleanup on php aisle 5.6 and some stocking shelves on php aisle 7.4. Apache restarted without a whimper after all my config and mod changes; thought I was good to go. But 3 of my 4 sites would not load; no clean 404 page, just this misconfiguration message.
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
After reviewing the /var/log/apache2/error.log
, I found this:
[Wed May 06 03:55:16.190469 2020] [core:alert] [pid 5657] [client 10.10.10.10:56897]
/var/www/abc/example.com/.htaccess: No comments are allowed here, referer: https://example.com/
After trying several different things, it seems that comments that start the line are NOT the issue, it is comments that end a normal line of the file. Removing or moving these #main office
comments to their own lines bring everything back online. The # Allow from this IP address
line is still in my .htaccess file but does not cause me any grief.
<Files wp-login.php>
order deny,allow
Deny from all
#
# Allow from this IP address
allow from 10.10.10.10 #main office
allow from 10.10.11.10 #satellite office
</Files>
Is this a 'bug' or a 'feature'? A search in Google for ".htaccess: No comments are allowed here" brings up almost nothing. (You know you are in trouble when the 4th hit is in a foreign language). Obviously the jump to Ubuntu 18.04 or the associated apache or php updates are the 'when', but WHY? Why is this in-line documentation problematic? What gives?