-
-
Notifications
You must be signed in to change notification settings - Fork 30
/
.htaccess
124 lines (84 loc) · 5.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
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
123
124
# .htaccess voor phpcheatsheets.com
Options -Indexes -MultiViews
# Prevent users from opening and reading php include files
# Prevent users from viewing htaccess / htpasswd files
# Prevent users from viewing logfiles
<FilesMatch "\.(htaccess|htpasswd|ini|phps|inc|log|sh|md|bak|bat|yml|gitignore|gitmodules|gitattributes)$">
Order Allow,Deny
Deny from all
</FilesMatch>
# Redirect all visitors to an SSL connection.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{SERVER_NAME}/$1 [R=301,L]
</IfModule>
# Redirects for files which no longer exist
# 4.3.(0)9 => 4.3.11
RedirectMatch 301 /static_results/(arithmetic|compare|test)/php4\.3\.(0)?9\.html$ https://phpcheatsheets.com/static_results/$1/php4.3.11.html
# 5.0.4 => 5.0.5
RedirectMatch 301 /static_results/(arithmetic|compare|test)/php5\.0\.4\.html$ https://phpcheatsheets.com/static_results/$1/php5.0.5.html
# 5.2.(0)4/6/8/9/9-2 => 5.2.17
RedirectMatch 301 /static_results/(arithmetic|compare|test)/php5\.2\.(0)?[4689](-2)?\.html$ https://phpcheatsheets.com/static_results/$1/php5.2.17.html
# 5.3.02 / 5.3.2 => 5.3.3
RedirectMatch 301 /static_results/(arithmetic|compare|test)/php5\.3\.(0)?2\.html$ https://phpcheatsheets.com/static_results/$1/php5.3.3.html
# 5.3.27 => 5.3.29
RedirectMatch 301 /static_results/(arithmetic|compare|test)/php5\.3\.27\.html$ https://phpcheatsheets.com/static_results/$1/php5.3.29.html
# 5.4.(0)6 => 5.4.4
RedirectMatch 301 /static_results/(arithmetic|compare|test)/php5\.4\.(0)?6\.html$ https://phpcheatsheets.com/static_results/$1/php5.4.4.html
# 5.4.11/20 => 5.4.16
RedirectMatch 301 /static_results/(arithmetic|compare|test)/php5\.4\.(11|20)\.html$ https://phpcheatsheets.com/static_results/$1/php5.4.16.html
# 5.4.33/35 => 5.4.27
RedirectMatch 301 /static_results/(arithmetic|compare|test)/php5\.4\.3[35]\.html$ https://phpcheatsheets.com/static_results/$1/php5.4.27.html
# 5.4.36/37/39/41/42/43 => 5.4.45
RedirectMatch 301 /static_results/(arithmetic|compare|test)/php5\.4\.(3[679]|4[123])\.html$ https://phpcheatsheets.com/static_results/$1/php5.4.45.html
# 5.5.3 => 5.5.9
RedirectMatch 301 /static_results/(arithmetic|compare|test)/php5\.5\.3\.html$ https://phpcheatsheets.com/static_results/$1/php5.5.9.html
# 5.5.16/18/20/21/24 => 5.5.22
RedirectMatch 301 /static_results/(arithmetic|compare|test)/php5\.5\.(1[68]|2[014])\.html$ https://phpcheatsheets.com/static_results/$1/php5.5.22.html
# 5.5.26/28/33 => 5.5.30
RedirectMatch 301 /static_results/(arithmetic|compare|test)/php5\.5\.(2[68]|33)\.html$ https://phpcheatsheets.com/static_results/$1/php5.5.30.html
# 5.5.35/37 => 5.5.38
RedirectMatch 301 /static_results/(arithmetic|compare|test)/php5\.5\.3[57]\.html$ https://phpcheatsheets.com/static_results/$1/php5.5.38.html
# 5.6.0/2/4/5/8/9 => 5.6.7
RedirectMatch 301 /static_results/(arithmetic|compare|test)/php5\.6\.[024589]\.html$ https://phpcheatsheets.com/static_results/$1/php5.6.7.html
# 5.6.10/11/13/15/17 => 5.6.16
RedirectMatch 301 /static_results/(arithmetic|compare|test)/php5\.6\.1[01357]\.html$ https://phpcheatsheets.com/static_results/$1/php5.6.16.html
# 5.6.19/20/23/25 => 5.6.21
RedirectMatch 301 /static_results/(arithmetic|compare|test)/php5\.6\.(19|20|23|25)\.html$ https://phpcheatsheets.com/static_results/$1/php5.6.21.html
# 5.6.28/29/31/32 => 5.6.30
RedirectMatch 301 /static_results/(arithmetic|compare|test)/php5\.6\.(2[89]|3[12])\.html$ https://phpcheatsheets.com/static_results/$1/php5.6.30.html
# 7.0.0alpha1/RC6 => 7.0.4
RedirectMatch 301 /static_results/(arithmetic|compare|test)/php7\.0\.0(alpha1|RC[1-8])\.html$ https://phpcheatsheets.com/static_results/$1/php7.0.4.html
# 7.0.0/2/6/8/10 => 7.0.4
RedirectMatch 301 /static_results/(arithmetic|compare|test)/php7\.0\.([0268]|10)\.html$ https://phpcheatsheets.com/static_results/$1/php7.0.4.html
# 7.0.12/13/14/17/21 => 7.0.19
RedirectMatch 301 /static_results/(arithmetic|compare|test)/php7\.0\.(1[2347]|21)\.html$ https://phpcheatsheets.com/static_results/$1/php7.0.19.html
# 7.0.26 => 7.0.27
RedirectMatch 301 /static_results/(arithmetic|compare|test)/php7\.0\.26\.html$ https://phpcheatsheets.com/static_results/$1/php7.0.27.html
# 7.1.0alpha3 /7.1.0/3/7 => 7.1.5
RedirectMatch 301 /static_results/(arithmetic|compare|test)/php7\.1\.(0alpha3|0|3|7)\.html$ https://phpcheatsheets.com/static_results/$1/php7.1.5.html
# 7.1.12 => 7.1.18
RedirectMatch 301 /static_results/(arithmetic|compare|test)/php7\.1\.12\.html$ https://phpcheatsheets.com/static_results/$1/php7.1.18.html
# 7.2.0beta1/7.2.0 => 7.2.3
RedirectMatch 301 /static_results/(arithmetic|compare|test)/php7\.2\.(0|0beta1)\.html$ https://phpcheatsheets.com/static_results/$1/php7.2.3.html
# Add 404 directives
ErrorDocument 403 /index.php?page=error&e=403
ErrorDocument 404 /index.php?page=error&e=404
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_METHOD} ^(HEAD|TRACE|DELETE|TRACK|DEBUG) [NC]
RewriteRule ^(.*)$ - [F,L]
# Redirect GET requests from the dropdown to html files
RewriteCond %{QUERY_STRING} page=(arithmetic|compare|test)&tab=([a-z0-9_-]+)&phpversion=(php[0-9\.-]+((alpha|beta|RC)([0-9])?)?) [NC]
RewriteRule index.php /static_results/%1/%3.html#%2? [NE,R=301,L]
RewriteCond %{QUERY_STRING} page=(arithmetic|compare|test)&tab=&phpversion=(php[0-9\.-]+((alpha|beta|RC)([0-9])?)?) [NC]
RewriteRule index.php /static_results/%1/%2.html? [R=301,L]
RewriteCond %{QUERY_STRING} page=(arithmetic|compare|test)&phpversion=(php[0-9\.-]+((alpha|beta|RC)([0-9])?)?) [NC]
RewriteRule index.php /static_results/%1/%2.html? [R=301,L]
# Redirect pretty urls
RewriteRule ^(arithmetic|compare|test)/([a-z0-9_-]+)/ajax[/]?$ index.php?page=$1&tab=$2&do=ajax [QSA,NC,L]
RewriteRule ^(arithmetic|compare|test)/([a-z0-9_-]+)[/]?$ index.php?page=$1&tab=$2 [QSA,NC,L]
RewriteRule ^(arithmetic|compare|test|other-cheat-sheets|about)[/]?$ index.php?page=$1 [NC,L]
</IfModule>