Issue
In a folder say /folderX/
there are 4 .txt files.
A php script currently makes new files if unexistend, based on the site.org/foo/
of the url it updates a new file if foo.txt does not exist, then it will go ahead and create it.
But I would wish to: A) If the existing file is already in the folder, then allow it to update/rewrite it BUT B) If the file is non existing e.g. foo.txt, then DONT allow it to create any more new files in folder /folderX/
Reason is that search engines sometimes accidentally check folders like /images/ or /icons/ or /articles/ etc and all those files become then created and PHP goes processing them. If the file cannot be made, then probably PHP will not process them and give them strange crawlers the error they deserve to see.
What properties should I set in the FTP folder folderX, to overule any PHP scripts and cause a disallowance of creation of any further new files in that folder?
Essentially I hop that a particular CHMOD will make this possible. Thanks very much for your suggestions.
Solution
If all the files are created, then you can set the permisson 555
on the folder to remove the write flag for other users (webserver and PHP) and owner on directory entries. The files within will retain the rw-
flag and thus still be writable.
Note that this only works if no PHP script deletes any of the fileX.txt
entries. Once unliked the write permissions are gone.
(Btw, you could also use the permission 111
on the folder to even disallow listing of contents within that folder. More sneaky. But there's probably no need.)
Answered By - mario Answer Checked By - Willingham (WPSolving Volunteer)