Connect second domain to web site

Started by RanKumar, Nov 17, 2022, 10:05 AM

Previous topic - Next topic

RanKumarTopic starter


I would like to inquire about attaching a second domain to an Open Cart site. Currently, the domain is registered with hosting DNS, while a new domain alias has been created through ISPmanager on the hosting.

However, I have encountered an issue where only the main page of the site is functional under the new domain. Upon selecting links on the site, the old domain is still registered.

Do you have any recommendations on how to resolve this issue? Thank you.


Doesn't it concern you that this could result in changes to search results, which may view it as duplicate content? If not, then it is recommended to review the web server settings, specifically the configuration of VirtualHosts and .htaccess. Pay attention to ReWrite_cond as an alias is a redirect to the main domain.

One solution would be to make a substitution so that switching from domain-1 to domain-2 becomes easier. In the hosting's main directory, there is a .htaccess file where the following can be entered:

# HTTP Rule
RewriteCond %{HTTP_HOST} ^www.domain-1\.com
RewriteRule ^(.*)$ http://domain-2/$1 [R=301,L]
RewriteCond %{HTTP_HOST} ^www.domain-2\.com
RewriteRule ^(.*)$ http://domain-2/$1 [R=301,L]
RewriteCond %{HTTP_HOST} ^domain-1\.com
RewriteRule ^(.*)$$1 [R=301,L]

It's important to note that this example takes into account different visits from www or without it. If there is SSL, the https addresses should also be treated sensitively.


To resolve the issue with the old domain still being registered when selecting links on the site, you can try the following steps:

1. Update the OpenCart configuration: Log in to your OpenCart admin panel and go to System > Settings. Then, click on the "Edit" button for your store and navigate to the "Server" tab. Make sure that the "HTTP_SERVER" and "HTTPS_SERVER" fields have the correct domain name for your new domain.

2. Check the database: Open your OpenCart database using a tool like phpMyAdmin or any other database administration tool. Look for the "oc_store" table and ensure that the "url" field contains the correct URL for your new domain.

3. Clear your cache: Clear any caching mechanisms that might be in place on your website, including browser cache, server-side cache, and any caching extensions or plugins you may have installed on OpenCart.

4. Rewrite rules: If you have any rewrite rules in your .htaccess file or server configuration, make sure they are correctly configured for the new domain. Check for any references to the old domain and update them accordingly.

5. Test on different devices and networks: Ensure that the issue is not specific to a device or network. Test the site using different devices and networks to see if the problem persists.

If these steps do not resolve the issue, it is recommended to consult with your hosting provider or seek assistance from the OpenCart support community for further guidance.