SSL Certificates

Dec 01, 2020 40 Replies

It is as well to rename the old one to z.htaccess on the server then you can unwind it fairly quickly. I have periodic troubles with it myself.

I have been trying to add defensive anti malicious probes redirects (mainly to stop the log filling up with 404's). This is the .htaccess script which works after a fashion but only to a very limited extent.

RewriteEngine On RewriteBase / RewriteRule ^gotcha\.html$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} "\.env|\.php|wp|\.git|\.js" RewriteRule . /gotcha.html [L]

IOW if the file doesn't exist on the site and contains any of the matches on the last RewriteCond line substitute a tiny html file containing just ">" prompt rather than a 404 Not Found.

It works OK for .php, wp- but not for .env, wp5 .wp .env .git or .js

Fails Not Found:

formatting link
Correct behaviour:
formatting link
Fails Not Found:
formatting link
Correct behaviour:
formatting link
Fails Not Found:
formatting link
Correct behaviour:
formatting link

Examples chosen to highlight the very perverse behaviour.

I am baffled by this behaviour and cannot see what I have done wrong.

I have recently taken over their website maintenance after the webmaster sadly died so I might be fighting some other directives elsewhere that I don't know about. My aim in doing this is to reduce the clutter in the logs (mostly injection attacks against Wordpress which isn't in use).

Thanks for any enlightenment.

Regards, Martin Brown

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required