Forum Moderators: phranque
Not sure if there is a way for .htaccess to prevent posting to non-existant files or not.Most rules don’t care whether the requested file actually exists or not. Why not globally block POST requests except for those specific files (such as a contact form) that actually require it? If you don’t have URLs in .php, you can also block any and all requests for .php (regardless of method).
[26/Mar/2019:12:50:29 -0600] "POST /wp-pg.php HTTP/1.1" 500
The thing is none of the files were existing files. Even in the domains with wordpress. Perhaps it was happenstance that they didn't pick an actual file?
It seems like its an overflow thing with Apache or PHP. I would think its Apache since php should not have been called with no file existing. Not sure if its been fixed in apache.
The thing is that it placed that file by naming itself.
I currently do not have a php site running in the tree that has access to this area
Not sure if there is a way for .htaccess to prevent posting to non-existant files or not. -- this may have been fixed in a new/updated version of apache, but it makes sense to just not allow posting to non-existant files anyway.
Block ALL PHP? But as I said, I am about to install Wordpress in that area, and its already installed in other domains/directory trees.
htaccess is blocking HTTP requests, not filesystem requests.
phranque: .htaccess file directives can block both.
What I mean is that a request must initially be made over HTTP for .htaccess to block it.You'd think so, but access controls in .htaccess also apply to internal requests, regardless of how the server is doing it. I learned this years ago* by direct observation: auto-generated indexes (which you may not even think of as php), php SSIs that are invisible to the user, you name it. If you're in mod_rewrite, a condition looking at %{THE_REQUEST} generally takes care of it.