Project

General

Profile

1
#### URL resolution
2

    
3
DirectorySlash on
4
DirectoryIndex index.php
5

    
6
### mod_rewrite
7

    
8
RewriteEngine on
9
RewriteBase /
10

    
11
# remove www subdomain
12
RewriteCond %{HTTP_HOST} ^www\.(.*)$
13
RewriteRule ^.*$ http://%1/$0 [redirect]
14

    
15
# translate subdomain to prefix
16
RewriteCond %{HTTP_HOST} ^([^.]*)\.(.*)$
17
RewriteCond %{DOCUMENT_ROOT}/%1 -d [ornext]
18
RewriteCond %{DOCUMENT_ROOT}/%1 -l
19
# this RewriteRule won't be re-run
20
RewriteCond %{DOCUMENT_ROOT}/%1/.htaccess -f
21
RewriteRule ^.*$ %1/$0 [nosubreq] # avoid infinite recursion
22

    
23
# don't rewrite existing paths
24
RewriteCond %{REQUEST_FILENAME} -d [ornext]
25
RewriteCond %{REQUEST_FILENAME} -f [ornext]
26
RewriteCond %{REQUEST_FILENAME} -l
27
RewriteRule ^.*$ - [last]
28

    
29
# translate path head to dir
30
RewriteCond %{DOCUMENT_ROOT}/$1 -d [ornext]
31
RewriteCond %{DOCUMENT_ROOT}/$1 -l
32
RewriteRule ^([^.]*)\.(.*)$ $1/$2
33

    
34
# non-filesystem paths
35
ErrorDocument 404 /
(1-1/5)