Article Image

You may want to redirect domain A to domain B (main URL):

  • A:
  • B:

Create a .htaccess on your webserver, in the www folder (of domain A):

RewriteEngine on
RewriteCond %{HTTP_HOST} ^ [NC,OR]
RewriteCond %{HTTP_HOST} ^ [NC]
RewriteRule ^(.*)$$1 [L,R=301,NC]
  1. RewriteEngine on : activation of the rewrite engine.
  2. RewriteCond %{HTTP_HOST} ^ [NC,OR] : rule to check for domain A
  3. RewriteCond %{HTTP_HOST} ^ [NC] : rule to check for sub-domain A
  4. RewriteRule ^(.*)$$1 [L,R=301,NC] : redirection rule
  • ^(.*)$ : $1 is the right side of the URL (contact-me).
  • New domain for the redirection and add the page to find - $1.
  • Type of redirection : 301, permanent redirection.
Blog Logo

Florent Bertiaux

I'm a blogger



I learned something new

A blog from @kxrz - Dev tips and tricks

Back to Overview