Herzlich willkommen im Archiv vom ABAKUS Online Marketing Forum
Du befindest Dich im Archiv vom ABAKUS Online Marketing Forum. Hier kannst Du Dich für das Forum mit den aktuellen Beiträgen registrieren.
Code: Alles auswählen
RewriteEngine on
# Rewrite <subdomain>.example.com/<path> to example.com/<subdomain>/<path>
#
# Skip rewrite if no hostname or if subdomain is www
RewriteCond %{HTTP_HOST} ^unilounge\.at$
RewriteRule ^(.*)$ http://www.unilounge.at/$1 [L,R=301]
RewriteCond %{HTTP_HOST} ^www\.([^.]+)\.unilounge\.at$
RewriteRule ^(.*)$ http://%1.unilounge.at/$1 [L,R=301]
RewriteCond %{HTTP_HOST} .
RewriteCond %{HTTP_HOST} !^www\. [NC]
# Extract (required) subdomain (%1), and first path element (%3), discard port number if present (%2)
RewriteCond %{HTTP_HOST}<>%{REQUEST_URI} ^www\.([^.]+)\.unilounge\.at(:80)?<>/([^/]*) [OR]
RewriteCond %{HTTP_HOST}<>%{REQUEST_URI} ^([^.]+)\.unilounge\.at(:80)?<>/([^/]*) [NC]
# Rewrite only when subdomain not equal to first path element (prevents mod_rewrite recursion)
RewriteCond %1<>%3 !^(.*)<>\1$ [NC]
# Rewrite to /subdomain/path
RewriteRule ^(.*) /%1/$1 [L]