Rewrite Regeln

Das hier ist eine Sammlung zu Apache-Rewrite Regeln

Rewrite von http auf https

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}

Rewrite von http auf https ausser let's encrypt

RewriteEngine On
RewriteCond %{REQUEST_URI} !^/\.well\-known/acme\-challenge/
RewriteRule ^(.*)$ https://%{HTTP_HOST}$1 [R=301,L]

Rewrite von domian.at auf http://www.domain.at

RewriteCond %{HTTP_HOST} ^domain\.at
RewriteRule ^(.*)$ http://www.domain.at$1 [R=301,L]

Rewrite von http://www.domain.at auf domain.at

RewriteCond %{HTTP_HOST} ^www\.domain\.at$ [NC]
RewriteRule ^(.*)$ http://domain.at/$1 [R=301,L]

Umleiten von http://www.domain.at/asdf auf asdf.domain.at

RewriteRule ^/asdf$ http://asdf.domain.at [QSA,R]

Beim Aufruf von asdf.domain.at ins Verzeichnis XYZ umleiten

RewriteCond %{HTTP_HOST}   ^asdf.domain.at$ [NC]
RewriteRule   ^/(.*)$ /XYZ_domain/$1

Apache Killer Bugfix

RewriteEngine On
RewriteCond %{REQUEST_METHOD} ^(HEAD|GET) [NC]
RewriteCond %{HTTP:Range} ([0-9]*-[0-9]*)(\s*,\s*[0-9]*-[0-9]*)+ [OR]
RewriteCond %{HTTP:Request-Range} ([0-9]*-[0-9]*)(\s*,\s*[0-9]*-[0-9]*)+
RewriteRule .* - [F]