Difference between revisions of "Recirecting according to hostname"

From MyWiki
Jump to: navigation, search
(Created page with "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<br> <so...")
 
 
Line 5: Line 5:
 
RewriteCond %{HTTP_HOST} ^www\.site2\.com [NC]  
 
RewriteCond %{HTTP_HOST} ^www\.site2\.com [NC]  
 
RewriteRule ^(.*)$ index.php?lang=en [NC,QSA]  
 
RewriteRule ^(.*)$ index.php?lang=en [NC,QSA]  
 +
 +
</source>
 +
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<br>
 +
<source lang="text">
 +
RewriteEngine On
 +
RewriteCond %{HTTP_HOST} ^foo$ [OR]
 +
RewriteCond %{HTTP_HOST} ^foo.company.com$
 +
RewriteRule ^/?(.*)$ http://bar.company.com/$1 [R=301]
  
 
</source>
 
</source>

Latest revision as of 16:15, 13 June 2018

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]