Dynamické subdomény pomocí .htaccess
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### Source code moved to https://github.com/janpecha/htaccess-subdomains/ ### | |
## Custom Error Pages | |
#ErrorDocument 404 /errors/e404.html | |
<IfModule mod_dir.c> | |
DirectorySlash Off | |
</IfModule> | |
Options -Indexes | |
Options +FollowSymLinks | |
<IfModule mod_rewrite.c> | |
RewriteEngine on | |
## Custom Error Pages | |
#RewriteCond %{REQUEST_URI} ^/my-error-page\.html$ [OR] | |
#RewriteCond %{REQUEST_URI} ^/errors/e404\.html$ | |
#RewriteRule ^ - [L] | |
# presmerovani subdomeny s www na verzi bez www | |
RewriteCond %{HTTP_HOST} www\.(.*)\.([^\.]+)\.([^\.]*)$ | |
RewriteRule (.*)$ http://%1.%2.%3/$1 [R=301,L,NE] | |
# presmerovani domeny 2. radu na verzi s www | |
RewriteCond %{HTTP_HOST} ^([^\.]+)\.([^\.]*)$ | |
RewriteRule (.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L,NE] | |
# ochrana proti zacyklení | |
RewriteCond %{ENV:REDIRECT_STATUS} 200 | |
RewriteRule ^ - [L] | |
#kontrola existence subdomeny | |
RewriteCond %{HTTP_HOST} ^(.*)\.([^\.]*)\.([^\.]*)$ | |
RewriteCond %{DOCUMENT_ROOT}/%1_root !-d | |
RewriteRule ^ - [R=404,NC,L] | |
# presmerovani na verzi s lomitkem | |
RewriteCond %{HTTP_HOST} ^(.*)\.([^\.]*)\.([^\.]*)$ | |
RewriteCond %{DOCUMENT_ROOT}/%1_root/%{REQUEST_URI}/ -d | |
RewriteRule ^(.*)[^/]$ %{REQUEST_URI}/ [R=301,L,NE] | |
# podstrceni obsahu | |
RewriteCond %{HTTP_HOST} ^(.*)\.([^\.]*)\.([^\.]*)$ | |
RewriteRule ^(.*)$ %1_root/$1 [L] | |
</IfModule> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Source code moved to GitHub repository - https://github.com/janpecha/htaccess-subdomains/