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

前端 未结 7 1029
终归单人心
终归单人心 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

    In the same situation, I used RedirectMatch, for two reasons. Primarily, it was the only method I could find that was allowed in .htaccess on that server with a fairly restrictive config that I couldn't modify. Also I consider it cleanest, because it allows me to tell Apache that yes, there's a file there, but just pretend it's not when serving, so return 404 (as opposed to 403 which would expose things that website viewers shouldn't be aware of).

    I now consider the following as a standard part of my .htaccess files:

    ## Completely hide some files and directories.
    RedirectMatch 404 "(?:.*)/(?:[.#].*)$"
    RedirectMatch 404 "(?:.*)~$"
    RedirectMatch 404 "(?:.*)/(?:CVS|RCS|_darcs)(?:/.*)?$"
    
    0 讨论(0)
提交回复
热议问题