Jump to content

How I can redirect to a new domain?


Antarr

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.COMm
        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?

Link to comment
Share on other sites

DOCUMENTATION (YOU MAY HAVE ALREADY FOLLOWED)   Moving PrestaShop

A PrestaShop installation does seldom remain at the same physical place. There are many reasons why you would need to move your PrestaShop files and data around:

  • Moving your shop from your local computer to your online server.
  • Moving your shop from a test sub-domain to the main domain.
  • Moving your shop from one server to another.
  • Moving your shop from one domain name to another.

In all of these circumstances, you must be careful to properly move both all of your files (including the custom images, your themes, the modules you bought...) and all your data (which is contained in your MySQL database).

Moving PrestaShop to a New Server

Here are the main steps when changing servers, or copying from your local hard-drive to your online server:

  1. Put your shop in maintenance mode, so as to not lose new customers or orders while moving the data.
    Go to your back office, and under the "Preference" menu, open the "Maintenance" page and set the "Enable shop" option to "No".
  2. Move your files:
    1. Make a backup of all the files: connect to your FTP server, and copy all the files and folders to your local hard-drive.
    2. Transfer your files to your new host: Connect to the FTP server for your new host, and copy all the files and folders that you just downloaded to your local hard-drive, as is.
  3. Move your data:
    1. Make a backup of you database (a "dump"): connect to phpMyAdmin, click on the "Export" tab, select the database of your PrestaShop installation, and click the "Go" button. Save the downloaded file on your hard-drive. If phpMyAdmin times out before it is able to export all your data, contact your host.
    2. Transfer the SQL dump to the new database: connect to the new server's phpMyAdmin, click on the "Import" tab, click the "Browse..." button, find the SQL file you just downloaded, and click the "Go" button to upload it. If phpMyAdmin times out before it is able to import all your data, contact your new host.
  4. Configure your shop:
    1. On the new server, open the /config/settings.inc.phpfile and update the settings for the new database server (with your own settings instead of the examples here):
      • define('_DB_SERVER_', 'sql.domainname.com');
      • define('_DB_NAME_', 'prestashop');
      • define('_DB_USER_', 'PS-user');
      • define('_DB_PASSWD_', 'djsf15');
      • define('_DB_PREFIX_', 'ps_');
    2. Log in to your back office, go to the "Preferences" menu, select the "SEO & URLs" page, and in the "Set shop URL" section change the domain name to your new domain. Do the same for the SSL domain.
      In effect, this will update the "ps_shop_url" SQL table (as well as the "PS_SHOP_DOMAIN" and "PS_SHOP_DOMAIN_SSL" rows in the "ps_configuration" SQL table, for retrocompatibility reasons).
  5. Connect to your new FTP server and delete everything except the index.phpfiles in the following folders:
    • /cache/smarty/cache
    • /cache/smarty/compile
  6. Go to your back office, and in the "Maintenance" preference page, set the "Enable shop" option back to "Yes".

You should be good to go! Check that all the links are functioning, that all your products, images, modules and themes are still there, and try to create a new account and place an order so as to make sure your shop is working as expected.

Moving PrestaShop to a New Domain

Here are the main steps when moving PrestaShop to a new domain within the same server. These are mostly a simpler version of the above steps – we do not touch the data, which stays on the same MySQL server.

  1. Put your shop in maintenance mode, so as to not lose new customers or orders will moving the data.
    Go to your back-office, and under the "Preference" menu, open the "Maintenance" page and set the "Enable shop" option to "No".
  2. Move your files
    1. Make a backup of all the files: connect to your FTP server, and copy all the files and folders to your local hard-drive.
    2. Transfer your files to your new host: Connect to the FTP server for your new host, and copy all the files and folders that you just downloaded to your local hard-drive, as is.
  3. Configuration
    1. On the new server, open the /config/settings.inc.php file and update the settings for the new database server (with your own settings instead of the examples here):
      • define('_DB_SERVER_', 'sql.domainname.com');
      • define('_DB_NAME_', 'prestashop');
      • define('_DB_USER_', 'PS-user');
      • define('_DB_PASSWD_', 'djsf15');
      • define('_DB_PREFIX_', 'ps_');
    2. Log in to your back office, go to the "Preferences" menu, select the "SEO & URLs" page, and in the "Set shop URL" section change the domain name to your new domain. Do the same for the SSL domain.
      In effect, this will update the "PS_SHOP_DOMAIN" and "PS_SHOP_DOMAIN_SSL" rows in the "ps_configuration" SQL table.
  4. Connect to your new FTP server and delete everything except the index.phpfiles in the following folders:
    • /tools/smarty/cache
    • /tools/smarty/compile
    • /tools/smarty_v2/cache
    • /tools/smarty_v2/compile
  5. Go to your back office, and in the "Maintenance" preference page, set the "Enable shop" option back to "Yes".

You should be good to go! Check that all the links are functioning, that all your products, images, modules and themes are still there, and try to create a new account and place an order so as to make sure your shop is working as expected.

 
Link to comment
Share on other sites

Hmmm maybe you should try to disable/enable friendly URL to rebuild .htaccess file.

 

Please also check manually if in ps_shop_url table if there is your new domain.

Have a look at ps_configuration table where name is PS_SHOP_DOMAIN and PS_SHOP_DOMAIN_SSL.

 

If everything is set correctly, I think it may be problem not with Presta but with domain assignment.

Edited by electriz (see edit history)
Link to comment
Share on other sites

 

No I'm not. This should change all values, but if not I bet that's something wrong with your store.

 

That's why I told you an alternative solution to edit it manually via database.

Link to comment
Share on other sites

Does not work.

The page isn't redirecting properly

Firefox has detected that the server is redirecting the request for this address in a way that will never complete.

And now, I got this error when I trying to go to the https://NEW.COM main page.

 

So I need now to unset this RewriteRules. They does not work and we back to the start.

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...