开发者

How to disable effects of .htaccess within a subfolder if there is a .htaccess file in root?

开发者 https://www.devze.com 2023-04-11 18:57 出处:网络
In my application I have separate spaces for user and admin like if www.example.com is my website, then www.example.com/admin is my admin URL.

In my application I have separate spaces for user and admin like if www.example.com is my website, then www.example.com/admin is my admin URL.

I am using a .htaccess file in my r开发者_开发知识库oot, and it affects some of the functionality in my admin folder, which I don't want to.

For example, consider below is my folder structure

..
.htaccess
index.php
admin

So if I don't want the .htaccess rules to apply within the admin folder, is there any way?


For people that don't have direct access to httpd.conf (shared hosting for example), just put another .htaccess file in the subfolder and set to the desired behavior.


You should be able to do this, but it does require write access to the httpd.conf configuration.

If you have access to the httpd.conf file, something like

    <Directory /admin>
      AllowOverride None
    </Directory

should do the trick.

Also, note that using .htaccess files in the root directory (as you said you did) is not a recommended approach. You'd be better off moving the contents of the htaccess file into the proper contexts of the httpd.conf file.

More information can be found at http://httpd.apache.org/docs/2.2/mod/core.html#allowoverride

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号