Jump to content

Redirect to a new domain does not work


Recommended Posts

I have old domain OLD.COM and recently bought a new one - NEW.COM which now should be the main name of the site while old name OLD.COM should be the alias with redirection to the main site.

 

there's Apache configuration^

<VirtualHost 8.8.8.8:80>
        ServerName OLD.COM
        ServerAlias www.OLD.COM
        Redirect permanent / https://NEW.COM/
</VirtualHost>

<VirtualHost 8.8.8.8:80>
        ServerName NEW.COM
        ServerAlias www.NEW.COM
        Redirect permanent / https://NEW.COM/
</VirtualHost>

<VirtualHost 8.8.8.8:443>
        ServerName NEW.COM
        ServerAlias OLD.COM www.OLD.COM www.NEW.COM
        DocumentRoot /usr/local/www/data/ftp/www/old.com
...
...
</VirtualHost>

I'm trying to add theese lines to a top of my .htaccess file:

RewriteCond %{HTTP_HOST} ^(www\.|)OLD\.COM$ [OR,NC]
RewriteRule ^(.*)$ https://NEW.COM/$1 [R=301,L]

but got error:

 

Too many redirects...

 

 

What could be the problem?

 

I changes domain name in the settings (SEO & URL).

I'm not moving any files nowhere.

All files remain the same in the same place - on the old server in the old directory.

I'm just adding new domain (new name of the site) as a main domain while old domain remains the alias.

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...