Skip to content

Instantly share code, notes, and snippets.

@Domm98CZ

Domm98CZ/.htaccess

Last active Mar 21, 2021
Embed
What would you like to do?
wedos main htaccess
RewriteEngine On
ErrorDocument 500 "500 - Vnitrni chyba!"
ErrorDocument 404 "404 - Stranka nenalezena!"
ErrorDocument 401 "Litujeme, ale nemate pravo k pristupu k tomuto souboru!"
ErrorDocument 403 "Litujeme, ale nemate pravo k pristupu k tomuto souboru!"
# 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]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment