-
Notifications
You must be signed in to change notification settings - Fork 5
/
.htaccess
35 lines (31 loc) · 1.29 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
# Allow webfonts from differnet (sub)domains
# (For example Typekit)
<FilesMatch "\.(ttf|ttc|otf|eot|woff)$">
<IfModule mod_headers.c>
Header set Access-Control-Allow-Origin "*"
</IfModule>
</FilesMatch>
RewriteEngine On
# Force www
# - Exclude urls starting with loaclhost
# - Check whether the Host value is not empty (in case of HTTP/1.0)
# - Check for 2 dots or not (instead of checking for www, because that would break subdomains)
# For the subdomain to work, in your subdomain folder should also be an .htaccess file.
# In its simplest form, this could look something like:
#
# RewriteEngine on
# RewriteBase /
#
# - Checks for HTTPS (%{HTTPS} is either on or off, so %{HTTPS}s is either ons or offs and in case of ons the s is matched)
# - The substitution part of RewriteRule then just merges the information parts to a full URL
RewriteCond %{HTTP_HOST} !^localhost
RewriteCond %{HTTP_HOST} ^(.*)$ [NC]
RewriteCond %{HTTP_HOST} !^(.*)\.(.*)\. [NC]
RewriteCond %{HTTPS}s ^on(s)|
RewriteRule ^ HTTP%1://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
# To force httpS uncomment the 2 lines below
# RewriteCond %{HTTPS} off
# RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L,NE]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^ index.php [QSA,L]