-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.htaccess
57 lines (44 loc) · 1.79 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
#### Force HTTPS://WWW and remove trailing / from files ####
## Turn on rewrite engine
RewriteEngine on
# Redirect
Redirect 301 "https://annagui.net/" "https://www.annagui.net/"
Redirect 301 "http://annagui.net/" "https://www.annagui.net/"
# Remove trailing slash from non-filepath urls
RewriteCond %{REQUEST_URI} /(.+)/$
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^ https://www.annagui.net/%1 [R=301,L]
# Include trailing slash on directory
RewriteCond %{REQUEST_URI} !(.+)/$
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^(.+)$ https://www.annagui.net/$1/ [R=301,L]
# Force HTTPS and WWW
RewriteCond %{HTTP_HOST} !^www\.(.*)$ [OR,NC]
RewriteCond %{https} off
RewriteRule ^(.*)$ https://www.annagui.net/$1 [R=301,L]
#### END Force HTTPS://WWW and remove trailing / from files ####
#RewriteCond %{HTTP_REFERER} !^http://annagui.net/.*$ [NC]
#RewriteCond %{HTTP_REFERER} !^http://annagui.net$ [NC]
#RewriteCond %{HTTP_REFERER} !^http://www.annagui.net/.*$ [NC]
#RewriteCond %{HTTP_REFERER} !^http://www.annagui.net$ [NC]
#RewriteCond %{HTTP_REFERER} !^https://annagui.net/.*$ [NC]
#RewriteCond %{HTTP_REFERER} !^https://annagui.net$ [NC]
#RewriteCond %{HTTP_REFERER} !^https://www.annagui.net/.*$ [NC]
#RewriteCond %{HTTP_REFERER} !^https://www.annagui.net$ [NC]
RewriteRule .*\.(jpg|jpeg|gif|png|bmp)$ - [F,NC]
# Redirect errors
ErrorDocument 404 https://www.annagui.net/
ErrorDocument 403 https://www.annagui.net/
ErrorDocument 400 https://www.annagui.net/
# Rename path .php to /
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.php [NC,L]
# Rename path .html to /
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.html [NC,L]
IndexIgnore *
IndexIgnore *.pdf
IndexIgnore *.jpg
DirectoryIndex index.html