From 7d336b3b5e1149427f8cf225315d28a50aa88543 Mon Sep 17 00:00:00 2001 From: Nabeel Shahzad Date: Sat, 23 Dec 2017 10:28:56 -0600 Subject: [PATCH] Block files in shared hosting --- .htaccess | 56 +++++++++++++++++++++++++++++++++++++++---------------- 1 file changed, 40 insertions(+), 16 deletions(-) diff --git a/.htaccess b/.htaccess index df8233ed..f35544bc 100755 --- a/.htaccess +++ b/.htaccess @@ -1,25 +1,49 @@ # Disable index view Options -Indexes -# Hide a specific file - - Order allow,deny - Deny from all - - - - Order allow,deny - Deny from all - - -# Hide a specific file - - Order allow,deny - Deny from all - +## Hide a specific file +# +# Order allow,deny +# Deny from all +# +# +# +# Order allow,deny +# Deny from all +# +# +## Hide a specific file +# +# Order allow,deny +# Deny from all +# RewriteEngine On +# Deny all these files/folders +RedirectMatch 403 ^/.git/.*?$ +RedirectMatch 403 ^/.travis/.*?$ +RedirectMatch 403 ^/app/.*?$ +RedirectMatch 403 ^/bootstrap/.*?$ +RedirectMatch 403 ^/config/.*?$ +RedirectMatch 403 ^/modules/.*?$ +RedirectMatch 403 ^/node_modules/.*?$ +RedirectMatch 403 ^/resources/.*?$ +RedirectMatch 403 ^/storage/.*?$ +RedirectMatch 403 ^/tests/.*?$ +RedirectMatch 403 ^/vendor/.*?$ +RedirectMatch 403 ^/.bowerrc$ +RedirectMatch 403 ^/artisan$ +RedirectMatch 403 ^/composer.json +RedirectMatch 403 ^/composer.lock +RedirectMatch 403 ^/composer.phar +RedirectMatch 403 ^/env.php.*?$ +RedirectMatch 403 ^/Makefile +RedirectMatch 403 ^/package.json +RedirectMatch 403 ^/package-lock.json +RedirectMatch 403 ^/phpunit.xml +RedirectMatch 403 ^/webpack.mix.js + # Redirect Trailing Slashes If Not A Folder... RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)/$ /$1 [L,R=301]