# 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: https://kb.wedos.com/cs/webhosting/htaccess/htaccess-na-webhostingu RewriteEngine On RewriteCond %{HTTP_HOST} ^posezenicko.site [NC] RewriteRule ^(.*)$ https://www.posezenicko.site/$1 [L,R=301] # 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]