skip to Main Content

I am trying to redirect the homepage of the old site site1.com] to the homepage of the new site site2.com], excluding subpages and parameters.

Redirects like:

site1.com – > site2.com redirect

site1.com/ – > site2.com redirect

site1.com/subpage/ – no redirect

site1.com/index.php?id= – no redirect

site1.com/?parameter= – no redirect

2

Answers


  1. You can use the following rule in your site1/.htaccess :

    RewriteEngine on
    
    RewriteCond %{QUERY_STRING} ^$
    RewriteRule ^$ https://site2.com/ [L,R=301]
    
    Login or Signup to reply.
  2. Could you please try following. Basically looks for if either query string is empty or request uri is empty then redirect to other domain site.

    RewriteEngine on
    RewriteCond %{QUERY_STRING} ^$
    RewriteCond %{HTTP_HOST} site1.com [NC]
    RewriteRule ^$ https://site2.com/ [L,R=301]
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search