jojo's blog--快樂憂傷都與你同在
          為夢想而來,為自由而生。 性情若水,風起水興,風息水止,故時而激蕩,時又清平……
          posts - 11,  comments - 30,  trackbacks - 0
          <Location /obcart/index.php>
           Order Deny,Allow
           Deny from All
           Satisfy All
          </Location>

          RedirectMatch 404 /".svn(/|$)

          -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
          This is straight from the mailing list with grateful thanks to Ryan Schmidt.

          Sometimes I can be a bit slow so I hadn't even considered blocking access to the .svn folders on this and other sites I maintain. I have now! There are two solutions:

          <Files ".svn">

          Order allow,deny

          Deny from all

          </Files>

          <DirectoryMatch "/".svn/">

          Order allow,deny

          Deny from all

          </DirectoryMatch>

          and:

          RedirectMatch 404 /".svn(/|$)

          ====================================================================================================


          Apache Tips & Tricks: Deny access to some folders

          Applies: apache 1.3.x / apache 2.0.x
          Required apache module: mod_access
          Scope: global server configuration, virtual host, directory, .htaccess
          Type: security

          Description: How to deny access to certain folders and the files inside them.
          Useful: to deny access to certain folders containing private information (log files, source code, password files, etc.). The example shown here will address the question posted by Saul Howard on how to deny access to all the subversion directories (.svn).

          I a previous tip (Deny access to certain file types) I have showed how we can deny access to files using a particular filename or all the files with a particular extension or any regexp we can match the files. In this post we will block access to folders, so instead of using the <Files> directive we will be using the <Directory> section.

          Allow/Deny Directive in <Directory>

          Let’s see how we can deny access to all the .svn folders that exist on the server.
          In order to achieve this we will add the following configuration lines in the appropriate context (either global config, or vhost/directory, or from .htaccess):

          <Directory ~ "".svn">
          Order allow,deny
          Deny from all
          </Directory>

          Similar to this we can deny access to other folders we might need…

          Note: this will show a Forbidden page (code 403) even if the folder does not exist and it is just called from the browser in the url.
          Another way how this can be quickly accomplished is by using a Rewrite rule:

          RewriteRule ^(.*/)?"".svn/ - [F,L]

          or using a redirect:

          RedirectMatch 404 /"".svn(/|$)

          (in this last example I am using 404 as the returned code so this looks like the folder doesn’t exist on the server; of course if you prefer you can return 403 - forbidden code).

          Go to:
          Main page of all my Apache Tips & Tricks




          posted on 2009-04-20 15:07 Blog of JoJo 閱讀(376) 評論(0)  編輯  收藏 所屬分類: Linux 技術相關

          <2025年6月>
          25262728293031
          1234567
          891011121314
          15161718192021
          22232425262728
          293012345

          常用鏈接

          留言簿(6)

          隨筆檔案

          文章分類

          文章檔案

          新聞分類

          新聞檔案

          相冊

          收藏夾

          搜索

          •  

          最新評論

          閱讀排行榜

          評論排行榜

          主站蜘蛛池模板: 肥乡县| 娄底市| 德化县| 惠州市| 平南县| 屏边| 禄劝| 会昌县| 随州市| 都江堰市| 虎林市| 如皋市| 兴国县| 资兴市| 连江县| 东阳市| 土默特右旗| 庐江县| 汶上县| 富裕县| 麻江县| 桃江县| 朝阳市| 芷江| 瑞昌市| 娱乐| 金乡县| 萝北县| 阳春市| 正蓝旗| 灵宝市| 积石山| 临颍县| 青海省| 东阳市| 沈丘县| 荣昌县| 理塘县| 乌什县| 泸水县| 孟村|