33 lines
1.2 KiB
ApacheConf
33 lines
1.2 KiB
ApacheConf
# htaccess rules for subdomains and aliases
|
|
# to create new subdomain, create a folder www/subdom/(subdomain name)
|
|
# to create web for alias, create a folder www/domains/(whole domain name)
|
|
|
|
# htaccess pravidla pro subdomeny a samostatne weby aliasu
|
|
# pro vytvoreni subdomeny vytvorte adresar www/subdom/(nazev subdomeny)
|
|
# pro vytvoreni webu pro alias vytvorte adresar www/domains/(cely domenovy nazev)
|
|
# dalsi info a priklady: http://kb.wedos.com/r/32/webhosting-htaccess.html
|
|
|
|
RewriteEngine On
|
|
|
|
# cele domeny (aliasy)
|
|
RewriteCond %{REQUEST_URI} !^domains/
|
|
RewriteCond %{REQUEST_URI} !^/domains/
|
|
RewriteCond %{HTTP_HOST} ^(www\.)?(.*)$
|
|
RewriteCond %{DOCUMENT_ROOT}/domains/%2 -d
|
|
RewriteRule (.*) domains/%2/$1 [DPI]
|
|
|
|
# subdomeny (s nebo bez www na zacatku)
|
|
RewriteCond %{REQUEST_URI} !^subdom/
|
|
RewriteCond %{REQUEST_URI} !^/subdom/
|
|
RewriteCond %{HTTP_HOST} ^(www\.)?(.*)\.([^\.]*)\.([^\.]*)$
|
|
RewriteCond %{DOCUMENT_ROOT}/subdom/%2 -d
|
|
RewriteRule (.*) subdom/%2/$1 [DPI]
|
|
|
|
# aliasy - spravne presmerovani pri chybejicim /
|
|
RewriteCond %{REQUEST_FILENAME} -d
|
|
RewriteRule ^domains/[^/]+/(.+[^/])$ /$1/ [R]
|
|
|
|
# subdomeny - spravne presmerovani pri chybejicim /
|
|
RewriteCond %{REQUEST_FILENAME} -d
|
|
RewriteRule ^subdom/[^/]+/(.+[^/])$ /$1/ [R]
|