How do I hide directories in Apache, specifically source-control?

前端 未结 7 1049
终归单人心
终归单人心 2020-12-02 13:40

I want to keep my website/s in version control (Subversion specifically) and use svn co to update it when there are stable versions to update, but I\'m concerne

7条回答
  •  既然无缘
    2020-12-02 14:16

    Two things:

    1. Do not use IfModule for functionality you need to be present. It's okay to do it for the autoindex because it might not be present and is not crucial to the scheme. But you are counting on rewrite being present to protect your content. Thus, it's better to remove the IfModule directive and let apache tell you when rewrite is not present for you to enable it (or at least know that you won't be 'protected' and consciously comment the lines)

    2. No need to use rewrite there if you have access to main configuration files, much easier would be one of

      
         Order allow,deny
         Deny from all
      
      

    which will generate 403 Forbidden (which is better from HTTP compliance point of view) or, if you want to take the security by obscurity route, use AliasMatch

        AliasMatch \.svn /non-existant-page
    

    If you don't have access to main configuration files you're left with hoping mod_rewrite is enabled for usage in .htaccess.

提交回复
热议问题