How to hide config files from direct access?

后端 未结 9 1979
野性不改
野性不改 2020-11-22 14:46

I am using Laravel for web app. Uploaded everything on production and found out that some of the files can be directly accessed by url - for example http://example.com/compo

9条回答
  •  抹茶落季
    2020-11-22 15:14

    With Apache, you can create .htaccess file in the root directory of Laravel project to rewrite all requests to public/ directory.

    
    RewriteEngine on
    RewriteRule ^(.*)$ public/$1 [L]
    
    

提交回复
热议问题