Apache服务器,拒绝所有请求,除了一个文件以及重写条件。

huangapple go评论50阅读模式
英文:

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>

不起作用 Apache服务器,拒绝所有请求,除了一个文件以及重写条件。
有什么线索吗?谢谢!

英文:

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 Apache服务器,拒绝所有请求,除了一个文件以及重写条件。
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.

huangapple
  • 本文由 发表于 2023年3月31日 19:11:05
  • 转载请务必保留本文链接:https://go.coder-hub.com/75897864.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定