forked from PerfectlySoft/Perfect
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathperfect.conf
46 lines (35 loc) · 1.27 KB
/
perfect.conf
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
### Load mod_perfect
<IfModule !perfect_module>
LoadModule perfect_module {{PATH_TO_MODS}}mod_perfect.dylib
</IfModule>
###
### Enable mod_rewrite for extensionless url mapping
<IfModule !rewrite_module>
LoadModule rewrite_module libexec/apache2/mod_rewrite.so
</IfModule>
###
### Starter virtual host
<VirtualHost *:80>
ServerName {{SERVER_NAME}}
DocumentRoot "{{DOCUMENT_ROOT}}"
<Directory "{{DOCUMENT_ROOT}}">
Require all granted
DirectoryIndex index.{{MUSTACHE_EXT}} index.html
</Directory>
RewriteEngine on
#unless directory, remove trailing slash
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ $1 [R=301,L]
#resolve .{{MUSTACHE_EXT}} file for extensionless mustache urls
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-d
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-f
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME}\.{{MUSTACHE_EXT}} -f
RewriteRule ^(.*)$ $1.{{MUSTACHE_EXT}} [NC,PT,L]
#redirect external .{{MUSTACHE_EXT}} requests to extensionless url
RewriteCond %{THE_REQUEST} ^[A-Z]+\ /([^/]+/)*[^.#?\ ]+\.{{MUSTACHE_EXT}}([#?][^\ ]*)?\ HTTP/
RewriteRule ^(([^/]+/)*[^.]+)\.{{MUSTACHE_EXT}} $1 [R=301,L]
<Location ~ "^.*\.{{MUSTACHE_EXT_SPLIT}}$">
SetHandler perfect-handler
</Location>
</VirtualHost>
###