-
-
Notifications
You must be signed in to change notification settings - Fork 5
/
.htaccess
52 lines (42 loc) · 1.41 KB
/
.htaccess
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# Deny access to all CGI, Perl, Python, Bash, SQL, Template, INI configuration, .env, cache, log, temporary and text files
<FilesMatch "\.(env|cgi|pl|py|sh|bash|sql|tpl|ini|cache|log|tmp|txt|md)$">
# Apache 2.4+
<IfModule mod_authz_core.c>
Require all denied
</IfModule>
# Apache 2.2
<IfModule !mod_authz_core.c>
Deny from all
</IfModule>
</FilesMatch>
# Deny access to all composer.json and error_log files
<FilesMatch "composer\.json|error_log">
# Apache 2.4+
<IfModule mod_authz_core.c>
Require all denied
</IfModule>
# Apache 2.2
<IfModule !mod_authz_core.c>
Deny from all
</IfModule>
</FilesMatch>
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews -Indexes
</IfModule>
Options +FollowSymLinks
RewriteEngine On
# Enable HSTS header to increase security of your website & SEO
<IfModule mod_headers.c>
Header set Strict-Transport-Security "max-age=31536000; preload" env=HTTPS
</IfModule>
# Remove www subdomain in the URL
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
RewriteRule ^(.*)$ https://%1/$1 [R=301,L]
# Redirect trailing slashes if it isn't a folder
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ /?$1 [L,R=301]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?$1 [L]
</IfModule>