1
|
#### URL resolution
|
2
|
|
3
|
DirectorySlash on
|
4
|
DirectoryIndex index.php
|
5
|
|
6
|
### mod_rewrite
|
7
|
|
8
|
RewriteEngine on
|
9
|
RewriteOptions inherit
|
10
|
RewriteBase /
|
11
|
|
12
|
# remove www subdomain
|
13
|
RewriteCond %{HTTP_HOST} ^www\.(.*)$
|
14
|
RewriteRule ^.*$ http://%1/$0 [redirect]
|
15
|
|
16
|
# translate subdomain to path prefix
|
17
|
RewriteCond %{HTTP_HOST} ^(.+)\.([^.]*\.[^.]*)$
|
18
|
RewriteRule ^.*$ http://%2/%1.$0 [redirect]
|
19
|
|
20
|
# don't rewrite existing paths
|
21
|
RewriteCond %{REQUEST_FILENAME} -d [ornext]
|
22
|
RewriteCond %{REQUEST_FILENAME} -f [ornext]
|
23
|
RewriteCond %{REQUEST_FILENAME} -l
|
24
|
RewriteRule ^.*$ - [last]
|
25
|
|
26
|
# non-filesystem paths
|
27
|
ErrorDocument 404 /index.php
|