Recirecting according to hostname

From MyWiki
Jump to: navigation, search

https://stackoverflow.com/questions/10232722/htaccess-rewrite-based-on-hostname-or-domain-name?utm_medium=organic&utm_source=google_rich_qa&utm_campaign=google_rich_qa

RewriteCond %{HTTP_HOST} ^www\.site1\.com [NC] 
RewriteRule ^(.*)$ index.php?lang=it [NC,QSA] 
RewriteCond %{HTTP_HOST} ^www\.site2\.com [NC] 
RewriteRule ^(.*)$ index.php?lang=en [NC,QSA]

https://serverfault.com/questions/439926/redirect-a-specific-hostname-to-another-hostname?utm_medium=organic&utm_source=google_rich_qa&utm_campaign=google_rich_qa

RewriteEngine On
RewriteCond %{HTTP_HOST} ^foo$ [OR]
RewriteCond %{HTTP_HOST} ^foo.company.com$
RewriteRule ^/?(.*)$ http://bar.company.com/$1 [R=301]