I want to write a plugin to return HTTP 404
when user request license.txt
, what is the correct action
to hook (both efficient and effective way to block)?
Update:
Because I don’t have control to the web server, I must do this as a plugin
I want to write a plugin to return HTTP 404
when user request license.txt
, what is the correct action
to hook (both efficient and effective way to block)?
Update:
Because I don’t have control to the web server, I must do this as a plugin
You must be logged in to post a comment.
Solution is actually pretty straightforward.
You need to create plugin which writes to .htaccess.
From now on your license.txt requests will be redirected to 404.
If you can’t create folders on server then you’ll need to zip the plugin’s folder and upload it using WP admin.
Cheers… counting bounty now 😛
You can’t. With a standard WordPress
.htaccess
, requests to static files are not passed to PHP at all, so there is no way to hook them.There is a plug-in that will do this for you. Just set the file you want to redirect and its target. It even keeps a log
http://wordpress.org/extend/plugins/redirection/