how to protect server directory using .htaccess

前端 未结 5 1675
-上瘾入骨i
-上瘾入骨i 2021-02-10 21:02

I have designed a website, and within it I have a range of PHP scripts which interact with my system. For example, if a user uploads an image, this is processed by the script

5条回答
  •  一个人的身影
    2021-02-10 21:50

    A lot of applications just put files like your scripts not in the public (like /public_html/ or /www/) folder but in the same root folder as your public folder.

    so not root/public_html/ and root/public_html/scripts/

    but root/public_html/ and root/scripts/

    Anything in a folder above the public folder can't be accessed by visitors, but by specifying in for example /public_html/index.php the file '../scripts/yourscript.php' PHP can access these files and visitors can't. (the folder ../ means "go up one step in the folder hierarchy")

提交回复
热议问题