Project

General

Profile

1 7876 aaronmk
#### URL resolution
2
3 7889 aaronmk
DirectorySlash on
4 7949 aaronmk
DirectoryIndex index.php
5 7876 aaronmk
6
### mod_rewrite
7
8 7878 aaronmk
RewriteEngine on
9 7892 aaronmk
RewriteBase /
10 7876 aaronmk
11 7959 aaronmk
# remove www subdomain
12
RewriteCond %{HTTP_HOST} ^www\.(.*)$
13
RewriteRule ^.*$ http://%1/$0 [redirect]
14
15 7968 aaronmk
# translate subdomain to prefix
16
RewriteCond %{HTTP_HOST} ^([^.]*)\.(.*)$
17
RewriteCond %1 -d [ornext]
18
RewriteCond %1 -l
19 7969 aaronmk
RewriteRule ^.*$ %1/$0 [nosubreq] # avoid infinite recursion
20 7966 aaronmk
21 7952 aaronmk
# don't rewrite existing paths
22
RewriteCond %{REQUEST_FILENAME} -d [ornext]
23
RewriteCond %{REQUEST_FILENAME} -f [ornext]
24 7957 aaronmk
RewriteCond %{REQUEST_FILENAME} -l
25 7952 aaronmk
RewriteRule ^.*$ - [last]
26
27 7970 aaronmk
# translate path head to dir
28
RewriteCond %{DOCUMENT_ROOT}/$1 -d [ornext]
29
RewriteCond %{DOCUMENT_ROOT}/$1 -l
30
RewriteRule ^([^.]*)\.(.*)$ $1/$2
31
32 7957 aaronmk
# non-filesystem paths
33
ErrorDocument 404 /index.php