-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.htaccess
More file actions
23 lines (18 loc) · 739 Bytes
/
Copy path.htaccess
File metadata and controls
23 lines (18 loc) · 739 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
<IfModule mod_rewrite.c>
RewriteEngine On
# Prevent directory browsing
Options -Indexes
# Block direct web access to sensitive environment, config, and script files
<FilesMatch "^\.env|composer\.(json|lock)|package\.(json|lock)|phpunit\.xml|artisan|deploy\.sh|\.gitignore">
Order allow,deny
Deny from all
</FilesMatch>
# Block access to .git repository if present
RewriteRule ^\.git - [F,L,NC]
# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
# Redirect all incoming requests to the public directory
RewriteCond %{REQUEST_URI} !^/public/
RewriteRule ^(.*)$ public/$1 [L]
</IfModule>