-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.htaccess-sample
122 lines (98 loc) · 3.26 KB
/
.htaccess-sample
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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
##############################################
# Override PHP configurations for this folder.
##############################################
<IfModule mod_php5.c>
php_value upload_max_filesize 40M
php_value post_max_size 40M
php_value memory_limit 1024M
</IfModule>
##############################################
# Serve all Gzip Javascript and CSS with the
# correct content type headers
##############################################
<IfModule mod_headers.c>
<FilesMatch "\.js\.gz$">
Header set Content-Type "application/javascript"
Header set Content-Encoding "gzip"
</FilesMatch>
<FilesMatch "\.css\.gz$">
Header set Content-Type "text/css"
Header set Content-Encoding "gzip"
</FilesMatch>
</IfModule>
#############################
# Start apache rewrite engine
#############################
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
######################
# WordPress INDEX file
######################
# If we go to /index.php, do nothing
# This is the first rule to make things faster.
RewriteRule ^index\.php$ - [L]
###################################
# Force SSL - only for secure sites
###################################
# RewriteCond %{HTTPS} off
# RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
######################################
# handle requests to files and folders
######################################
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
######################
# If gzipped CSS and JS files are available,
# server those files instead of the original ones.
######################
<FilesMatch "\.js$">
RewriteCond %{HTTP_USER_AGENT} !".*Safari.*"
RewriteCond %{HTTP:Accept-Encoding} gzip
RewriteCond %{REQUEST_FILENAME}.gz -f
RewriteRule (.*)\.js$ $1.js.gz [L]
</FilesMatch>
<FilesMatch "\.css$">
RewriteCond %{HTTP_USER_AGENT} !".*Safari.*"
RewriteCond %{HTTP:Accept-Encoding} gzip
RewriteCond %{REQUEST_FILENAME}.gz -f
RewriteRule (.*)\.css$ $1\.css.gz [L]
</FilesMatch>
######################
# Add a trailing slash to /wp-admin
######################
# for single and subdomain multisite
RewriteRule ^admin(.*)$ wp/wp-admin$1 [R=301,L]
RewriteRule ^wp-admin(.*)$ wp/wp-admin$1 [R=301,L]
RewriteRule ^wp-admin$ wp/wp-admin/ [R=301,L]
# for sub-folder multisite installations
# RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]
###########################################
# WordPress 'admin' and 'includes' requests
# Using WP skeleton:
# - WordPress in subdirectory 'wp'
# - 'content' folder in root folder
###########################################
# for single and subdomain multisite
# RewriteRule ^(wp-(admin|includes).*) wp/$1 [L]
# RewriteRule ^(content.*) $1 [L]
# RewriteRule ^(.*\.php)$ wp/$1 [L]
# for sub-folder multisite installations
# RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(admin|includes).*) wp/$2 [L]
# RewriteRule ^([_0-9a-zA-Z-]+/)?(content.*) $2 [L]
# RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ wp/$2 [L]
######################
# Any other requests needs to go to index.php
######################
RewriteRule . index.php [L]
</IfModule>
################################################
# Block XMLRPC for security
# Note:
# Some plugins require this to be enabled
################################################
<files xmlrpc.php>
order allow,deny
deny from all
</files>