How to set nginx to make a directory inaccessible
世界只因有你
世界只因有你 2017-05-16 17:28:57
0
1
882

I wrote a url rewrite, structure:

http://xxx.com/abc -> index.php/abc
http://xxx.com/abc/bcd -> index.php/abc/bcd

The abc/ directory must exist in the root directory for special reasons. At this time, something goes wrong. When accessing http://xxx.com/abc, you directly access this directory instead of url rewrite, but I hope it is the other way around. Prioritize access to rewrite, not the directory. At the same time, there is also a requirement that this is only true for this directory. Other directories should still access the directory first, and then rewrite

rewrite I wrote like this:

if (!-e $request_filename){
    rewrite ^/(.*)$ /index.php?/;
}
世界只因有你
世界只因有你

reply all(1)
我想大声告诉你
location /xxx {
 deny all;
 return 403;
}

xxx is the directory name

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!