-
-
Notifications
You must be signed in to change notification settings - Fork 43
/
.htaccess
119 lines (71 loc) · 3.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
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
# --- AUTOMAD --- #
<IfModule mod_rewrite.c>
# Allow large file uploads.
# Uncomment the following lines in case your server allows for setting those parameters.
#php_value upload_max_filesize 100M
#php_value post_max_size 100M
#php_value max_input_time 3000
#php_value max_execution_time 3000
# DO NOT MODIFY!
Options -Indexes
# To enable Pretty URLs just keep this file in the base folder.
# (next to the automad folder and the index.php)
# As long as you keep these files all togehter, you can even move
# the whole installation into a subfolder. It does not need to
# be the root folder of your site and this file does not need to
# be reconfigured in any case.
RewriteEngine On
# Do not modify the RewriteBase, even when running automad from a subfolder.
# The correct rewriting will be figured out automatically.
RewriteBase /
# Exclude home page from rewriting
RewriteRule ^$ - [L]
# Pretty URLs:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# To keep the app portable (can be moved around without configuration),
# the full path for the actual rewriting has to be determined,
# since the RewriteBase stays always '/'.
# To make that possible, the following RewriteCond is a dummy condition
# which is always true and is only used to figure out the base url
# by using back-references. (http://httpd.apache.org/docs/2.0/mod/mod_rewrite.html)
# Note: The RewriteRule is checked before (!) its RewriteConds. That actually
# makes the back-reference to (.*) available in the condition.
# For example the full URL is: www.yoursite.com/page/path
# '$1': Page path starting from your base url, taken from the ^(.*)$
# in the RewriteRule ( page/path )
# '#': Separator
# '%{REQUEST_URI}': The actual requested full URL ( www.yoursite.com/page/path )
# '([^#]*)': The string (here the value of $1)
# up to the separator ( page/path )
# '#': Separator again
# '(.*)': The requested URL without the page path ( www.yoursite.com )
# '\1$': The string up to the separator again ( /page/path )
RewriteCond $1#%{REQUEST_URI} ([^#]*)#(.*)\1$
# Everything after the base url (virtual page path) will be redirected to
# the second match "%2" from the above condition:
# ( www.yoursite.com ) + "index.php?/" + page/path
RewriteRule ^(.*)$ %2index.php?/$1 [QSA,L]
# Redirect blocked files to the 404 page.
# Redirect package thumbnails.
RewriteCond %{REQUEST_FILENAME} /cache/packages/.*/thumbnail [OR]
# Redirect src files.
RewriteCond %{REQUEST_FILENAME} /(packages|vendor)/.*\.(ts|less|php|md|sh|xml|json|lock)$ [OR,NC]
RewriteCond %{REQUEST_FILENAME} /vendor/.*(readme|license) [OR,NC]
RewriteCond %{REQUEST_FILENAME} /(package|package-lock|composer)\.(json|lock)$ [OR]
# Redirect data files.
RewriteCond %{REQUEST_FILENAME} /data$ [OR]
RewriteCond %{REQUEST_FILENAME} /index$ [OR]
RewriteCond %{REQUEST_FILENAME} /\.history$ [OR]
# Redirect trash.
RewriteCond %{REQUEST_FILENAME} /\.trash/ [OR]
# Redirect system files
RewriteCond %{REQUEST_FILENAME} \.DS_Store$ [OR,NC]
# Redirect all subdirectories.
RewriteCond %{REQUEST_FILENAME} -d
# Reuse the method described above to keep the app portable.
RewriteCond $1#%{REQUEST_URI} ([^#]*)#(.*)\1$
# Redirect to "_" which will display the 404 page.
RewriteRule ^(.*)$ %2index.php/_ [L]
</IfModule>
# --------------- #