How to allow access to a file?

#1
Please tell me how to make an exception for some files, access to which is denied through context by type?

There are several types of files, access to which is denied.

Static context:
URI: exp:^.* (log|ini|xml|txt|json)$
Location: $DOC_ROOT/$0
Accessible: No

How to allow access to some files with the xml and txt types. I tried different options, nothing works.
 

Cold-Egg

Administrator
#2
Create another static context using exp: to match the desired XML files, ensure it has a higher priority, and it should work.
 
#3
Cold-Egg, thank you! This is how it works:

Static context:
URL: exp:/sitemap.xml|robots.txt
Location: $DOC_ROOT/$0
Accessible: Yes

It doesn't work without the slash.
 
#5
I ran into a similar issue before, and what worked for me was adding a specific exception rule for the file types I wanted to allow. I had to make sure it was in the right place in my config or .htaccess file, right after any general access restrictions. After that, I was able to grant access to the .xml and .txt files while keeping the other restrictions in place. It took a bit of trial and error, but once I got the rule in the right spot, it worked fine.
 
Top