-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy path.htaccess
99 lines (85 loc) · 2.99 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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
# Secutiry rules & Wordpress default configuration.
<IfModule mod_headers.c>
Header set Access-Control-Allow-Origin "*"
</IfModule>
# Admin redirect
RedirectMatch 301 /admin/(.*) /wp/wp-admin/$1
# Audio files streaming
<FilesMatch "\.(mp3|m4a|aac|ogg|webm|wma)$">
ForceType application/octet-stream
Header set Content-Disposition attachment
</FilesMatch>
# Video files streaming
<FilesMatch "\.(avi|asf|mov|qt|mpg|mpeg|mp4|wmv|divx)$">
ForceType application/octet-stream
Header set Content-Disposition attachment
</FilesMatch>
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_HOST} .*helsingborg.se.*
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
</ifModule>
# Rewrite rules -
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
# add a trailing slash to /wp-admin
RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) wp/$2 [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ wp/$2 [L]
RewriteRule . index.php [L]
</ifModule>
# Prevent spam form submit
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_METHOD} POST
RewriteCond %{REQUEST_URI} .(wp-comments-post|wp-login)\.php*
RewriteCond %{HTTP_REFERER} !.*helsingborg.se.* [OR]
RewriteCond %{HTTP_USER_AGENT} ^$
RewriteRule (.*) http://%{REMOTE_ADDR}/$1 [R=301,L]
</ifModule>
# Prevent access to XML RPC & Pingback
<FilesMatch "^(xmlrpc\.php|wp-trackback\.php)">
Order Deny,Allow
Deny from all
</FilesMatch>
# Prevent drive-by-download attacks
<IfModule mod_headers.c>
Header set X-Content-Type-Options nosniff
</IfModule>
# Cache-Control Headers
<ifModule mod_headers.c>
<filesMatch "\.(ico|jpe?g|png|gif|swf)$">
Header set Cache-Control "public"
</filesMatch>
<filesMatch "\.(css)$">
Header set Cache-Control "public"
</filesMatch>
<filesMatch "\.(js)$">
Header set Cache-Control "private"
</filesMatch>
<filesMatch "\.(x?html?|php)$">
Header set Cache-Control "private, must-revalidate"
</filesMatch>
</ifModule>
# BEGIN Expire headers
<ifModule mod_expires.c>
ExpiresActive On
ExpiresDefault "access plus 5 seconds"
ExpiresByType image/x-icon "access plus 2592000 seconds"
ExpiresByType image/jpeg "access plus 3600 seconds"
ExpiresByType image/png "access plus 3600 seconds"
ExpiresByType image/gif "access plus 3600 seconds"
ExpiresByType application/x-shockwave-flash "access plus 2592000 seconds"
ExpiresByType text/css "access plus 3600 seconds"
ExpiresByType text/javascript "access plus 3600 seconds"
ExpiresByType application/javascript "access plus 3600 seconds"
ExpiresByType application/x-javascript "access plus 3600 seconds"
ExpiresByType text/html "access plus 600 seconds"
ExpiresByType application/xhtml+xml "access plus 600 seconds"
</ifModule>