forked from jrfnl/PHP-cheat-sheet-extended
-
Notifications
You must be signed in to change notification settings - Fork 1
/
.htaccess
119 lines (80 loc) · 5.58 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
# .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>
# 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$ http://phpcheatsheets.com/static_results/$1/php4.3.11.html
# 5.2.(0)4 => 5.2.6
RedirectMatch 301 /static_results/(arithmetic|compare|test)/php5\.2\.(0)?4\.html$ http://phpcheatsheets.com/static_results/$1/php5.2.6.html
# 5.2.(0)8/9 => 5.2.9-2
RedirectMatch 301 /static_results/(arithmetic|compare|test)/php5\.2\.(0)?[89]\.html$ http://phpcheatsheets.com/static_results/$1/php5.2.9-2.html
# 5.3.02 / 5.3.2 => 5.3.3
RedirectMatch 301 /static_results/(arithmetic|compare|test)/php5\.3\.(0)?2\.html$ http://phpcheatsheets.com/static_results/$1/php5.3.3.html
# 5.4.(0)6 => 5.4.4
RedirectMatch 301 /static_results/(arithmetic|compare|test)/php5\.4\.(0)?6\.html$ http://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$ http://phpcheatsheets.com/static_results/$1/php5.4.16.html
# 5.4.33/35/37 => 5.4.36
RedirectMatch 301 /static_results/(arithmetic|compare|test)/php5\.4\.3[357]\.html$ http://phpcheatsheets.com/static_results/$1/php5.4.36.html
# 5.4.39/42 => 5.4.41
RedirectMatch 301 /static_results/(arithmetic|compare|test)/php5\.4\.(39|42)\.html$ http://phpcheatsheets.com/static_results/$1/php5.4.41.html
# 5.4.43 => 5.4.45
RedirectMatch 301 /static_results/(arithmetic|compare|test)/php5\.4\.43\.html$ http://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$ http://phpcheatsheets.com/static_results/$1/php5.5.9.html
# 5.5.18 => 5.5.16
RedirectMatch 301 /static_results/(arithmetic|compare|test)/php5\.5\.18\.html$ http://phpcheatsheets.com/static_results/$1/php5.5.16.html
# 5.5.20/21/24 => 5.5.22
RedirectMatch 301 /static_results/(arithmetic|compare|test)/php5\.5\.2[014]\.html$ http://phpcheatsheets.com/static_results/$1/php5.5.22.html
# 5.5.26/28 => 5.5.30
RedirectMatch 301 /static_results/(arithmetic|compare|test)/php5\.5\.2[68]\.html$ http://phpcheatsheets.com/static_results/$1/php5.5.30.html
# 5.5.33 => 5.5.35
RedirectMatch 301 /static_results/(arithmetic|compare|test)/php5\.5\.33\.html$ http://phpcheatsheets.com/static_results/$1/php5.5.35.html
# 5.5.37 => 5.5.38
RedirectMatch 301 /static_results/(arithmetic|compare|test)/php5\.5\.37\.html$ http://phpcheatsheets.com/static_results/$1/php5.5.38.html
# 5.6.2 => 5.6.0
RedirectMatch 301 /static_results/(arithmetic|compare|test)/php5\.6\.2\.html$ http://phpcheatsheets.com/static_results/$1/php5.6.0.html
# 5.6.4/5/8/9 => 5.6.7
RedirectMatch 301 /static_results/(arithmetic|compare|test)/php5\.6\.[4589]\.html$ http://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$ http://phpcheatsheets.com/static_results/$1/php5.6.16.html
# 5.6.19 => 5.6.20
RedirectMatch 301 /static_results/(arithmetic|compare|test)/php5\.6\.19\.html$ http://phpcheatsheets.com/static_results/$1/php5.6.20.html
# 5.6.23 => 5.6.25
RedirectMatch 301 /static_results/(arithmetic|compare|test)/php5\.6\.23\.html$ http://phpcheatsheets.com/static_results/$1/php5.6.25.html
# 7.0.0alpha1/RC6 => 7.0.0
RedirectMatch 301 /static_results/(arithmetic|compare|test)/php7\.0\.0(alpha1|RC[1-8])\.html$ http://phpcheatsheets.com/static_results/$1/php7.0.0.html
# 7.0.2/6 => 7.0.4
RedirectMatch 301 /static_results/(arithmetic|compare|test)/php7\.0\.[26]\.html$ http://phpcheatsheets.com/static_results/$1/php7.0.4.html
# 7.0.8 => 7.0.12
RedirectMatch 301 /static_results/(arithmetic|compare|test)/php7\.0\.8\.html$ http://phpcheatsheets.com/static_results/$1/php7.0.12.html
# 7.0.10/13 => 7.0.12
RedirectMatch 301 /static_results/(arithmetic|compare|test)/php7\.0\.1[03]\.html$ http://phpcheatsheets.com/static_results/$1/php7.0.12.html
# 7.1.0alpha3 => 7.1.0
RedirectMatch 301 /static_results/(arithmetic|compare|test)/php7\.1\.0alpha3\.html$ http://phpcheatsheets.com/static_results/$1/php7.1.0.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>