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 %1 -d [ornext]
18
RewriteCond %1 -l
19
RewriteRule ^.*$ %1/$0 [nosubreq] # avoid infinite recursion
20

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

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

    
32
# non-filesystem paths
33
ErrorDocument 404 /index.php
(1-1/5)