Having multiple htaccess in a root directory

别来无恙 提交于 2019-12-13 07:19:54

问题


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

来源:https://stackoverflow.com/questions/38759904/having-multiple-htaccess-in-a-root-directory

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!