If your Tomatocart store is moved to a new domain, you have to implement 301 or 302 redirects for SEO purposes. Otherwise, you will face following problems:
- Your store page ranking will drop in search engines resulting in a loss of traffic.
- Any bookmarks or inbound links will no longer work as originally intended.
Redirect in .htaccess
Step 1. Open .htaccess file under your Tomatocart root directory.
Step 2. Add the following line to it:
As above image shows, I redirected my local Tomatocart store to online tomatocart.com with 301. My local store domain is tomatocart.me. Now, when I access www.tomatocart.me in my browser, a 301 redirect header will be received by browser. After that, the browser will be redirect me to tomatocart.com automatically.
Redirect in .php page
Step 1. Open application_top.php under tomatocart root directory > includes.
Step 2. Add following code at the top of code:
Step 1. Open index.php under templates > bootstrap fold.
Step 2. Add following code int it:
The redirection is done by the http-equiv refresh. The “content=1;” means redirect in 1 seconds. You can also change it to zero to redirect immediately.
Apache virtual host Redirect
Step 1. Go to /etc/apache2/sites-available to open the host file.
Step 2. Add the following code to the host file.
Step 3. Add the following code into same host file under /etc/apache2/sites-enabled.
Step 4. Run the following command on your server to reload apache host files.
sudo service apache2 reload
Note: if your web server does not run under ubuntu operation system, you need to find the correct virtual host file to add the same code.
The difference between 301 and 302
From an SEO perspective, if your store will use the new domain permanently, it is strongly recommended to use 301 redirects.
Otherwise, you should 302 redirect. For example, use a 302 redirect if you want to redirect mobile users on a mobile friendly page or for a temporary condition.