HTACCESS - Redirect Secondary Domains to Primary Domain

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

This is if you have multiple domains pointed to the same directory on a server.

Copy this code and paste it in your HTML
  1. Options +FollowSymLinks
  2. RewriteEngine On
  3. RewriteCond %{HTTP_HOST} ^$ [OR]
  4. RewriteCond %{HTTP_HOST} ^$
  5. RewriteRule (.*)$$1 [R=301,L]
  7. RewriteCond %{HTTP_HOST} ^$ [OR]
  8. RewriteCond %{HTTP_HOST} ^$
  9. RewriteRule (.*)$$1 [R=301,L]

Report this snippet


RSS Icon Subscribe to comments

You need to login to post a comment.