英文:
Apache sever, deny all except one file plus rewrite condition
问题
我试图拒绝整个文件夹,但仍然要使一个(或多个)重定向工作
<Directory "${INSTALL_DIR}/www/ssl">
order deny,allow
deny from all
</Directory>
现在,当指向/ssl/config时,我想要重定向到/ssl/config.json文件
<Directory "${INSTALL_DIR}/www/ssl/config">
Order Deny,Allow
Allow from all
FallbackResource "${INSTALL_DIR}/www/ssl/config.json"
</Directory>
不起作用
有什么线索吗?谢谢!
英文:
I am trying to deny entire folder, but still have one (several) redirects working
<Directory "${INSTALL_DIR}/www/ssl">
order deny,allow
deny from all
</Directory>
Now when points to /ssl/config I want a redirect to /ssl/config.json file
<Directory "${INSTALL_DIR}/www/ssl/config">
Order Deny,Allow
Allow from all
FallbackResource "${INSTALL_DIR}/www/ssl/config.json"
</Directory>
Not working
Any clues? Thank you!
答案1
得分: 1
The Fallback Resource is a file, located in the dir with full restriction Deny from all
. Like this your config.json
is restricted, also.
You have to extend the rules for the dir ${INSTALL_DIR}/www/ssl
:
<Directory "${INSTALL_DIR}/www/ssl">
order deny,allow
deny from all
<Files "config.json">
Order allow,deny
Allow from all
</Files>
</Directory>
Please Note: These "Allow/Deny"-rules are depreciated. You should use the new "Require"-rules.
英文:
The Fallback Resource is a file, located in the dir with full restriction Deny from all
. Like this your config.json
is restricted, also.
You have to extend the rules for the dir ${INSTALL_DIR}/www/ssl
:
<Directory "${INSTALL_DIR}/www/ssl">
order deny,allow
deny from all
<Files "config.json">
Order allow,deny
Allow from all
</Files>
</Directory>
Please Note: These "Allow/Deny"-rules are depreciated. You should use the new "Require"-rules.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论