Having multiple htaccess in a root directory

2019-09-05 10:23发布

问题:

I have directory in my website where user can upload projects or create sub directories, in the root dir i have a default .htaccess file and default.php which i don't want the user to get access to because i rewrite the dir to load default.php as default index page and also this to file will be copied to any sub dir that the user create. Now my problem is when user try to save .htaccess for the project he want to save it will show that is already exist. is there anything i can do to have multiple htaccess or write my own as default htaccess.

Second. is it possible to use one htaccess in all the sub dir so user can freely add their own? Example: bellow is how my directory look

WWW.example.com/ project /userprojectname/sub1/sub2/sub3/etc...

In project it has htaccess and users are not allow to do anything but their projectname will save there. In userprojectname it has an htaccess and default.php, they can also add more file or create directories and any sub dir will also have it own htaccess and default.php.

Now can i make htaccess in project work in all page? and as for default, i used jquery to disallow users creating file name default.php also is there a better way i can fix all this?

Bellow is my dirs and htacess file

Options +FollowSymlinks
RewriteEngine on

#This will block from accessing root folder
#RewriteCond %{REQUEST_FILENAME} !-f
#RewriteRule ^([^\.]+)$ $1.php [NC,L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([a-zA-Z0-9]+)$ $1.php [NC,L]

DirectoryIndex default.php