How to hide certain file type using apache .htaccess?

前端 未结 6 960
不知归路
不知归路 2020-12-15 07:59

Its been a long time since I\'ve needed to crack open an .htaccess file...

What is the simplest way to 40x prevent access to a specific file extension through out the

6条回答
  •  旧时难觅i
    2020-12-15 08:10

    You can also deny access to file extensions using RedirectMatch directive :

    RedirectMatch 403 ^/.+\.(php|html|gif)$
    

    This will return a 403 forbidden error for clients if they request any uri that ends with .php or .html or .gif . You can add more extensions to the pattern using a bar | .

提交回复
热议问题