.htaccess domain redirects


/ Published in: Bash
Save to your folder(s)



Copy this code and paste it in your HTML
  1. ###### always access from www and redirect multiple doamins to one
  2.  
  3. rewriteCond %{http_host} ^domain\.com$ [OR]
  4. rewriteCond %{http_host} ^domain\.org$ [OR]
  5. rewriteCond %{http_host} ^www\.domain\.org$ [OR]
  6. rewriteCond %{http_host} ^subdomain\.domain\.org$ [OR]
  7. rewriteCond %{http_host} ^www\.subdomain\.domain\.org$ [NC]
  8. rewriteRule ^(.*)$ http://www.domain.com/$1 [r=301,L]
  9.  
  10. ######always access from non-www and redirect multiple doamins to one
  11.  
  12. rewriteCond %{http_host} ^www\.domain\.com$ [NC]
  13. rewriteRule ^(.*)$ http://domain.com/$1 [r=301,L]

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.