Different Domains For Same X-CART Admin Site

Recently I came across a problem where I needed to give users both internal and remote access to the admin features of an x-cart ecommerce site.

Basically in this instance we host the admin portion of the site on an internal server and the actual online store is hosted in two data centres one in Ireland and the other in the UK.

The problem I had, I wanted to use two different domains e.g.



http://intheoffice/admin
http://workingremote.yourdomain.com/admin


The problem with earlier versions of x-cart is that you can only assign a single domain name to the one installation.

To do this you change
$xcart_http_host to point to the domain you wish to use

I was using WAMP on a Windows Server 2003 system

So to get around this, because I was using only the admin portion of the site

I knew the source code for the admin features would not change that often (if at all)

so I created two working directories


c:\webfolder\internal    // this is the directory that will contain code which will be executed from internal browser requests with http://intheoffice/admin



c:\webfolder\external    // this is the directory that will contain code which will be executed from external browser requests with http://workingremote.yourdomain.com/admin


I change the config.php in each code base to reflect the domain I'm serving


c:\webfolder\internal\config.php
$xcart_http_host = "http://intheoffice/admin";

c:\webfolder\external\config.php
$xcart_http_host = "http://workingremote.yourdomain.com/admin";

Then I configure httpd.conf in Apache under WAMP to serve content for different virtual hosts

Something like the following needs to be added

In my instance I was listening on port 8080 but you can use what ever you wish once its not already bound to another services on the windows system.

NameVirtualHost 192.168.0.33:8080


<VirtualHost 192.168.0.33:8080>
ServerName intheoffice

DocumentRoot "c:/webfolder/internal"
<Directory "c:/webfolder/internal">

allow from all
order allow,deny
AllowOverride All
</Directory>
</VirtualHost>

<VirtualHost 192.168.0.33:8080>
ServerName workingremote.yourdomain.com
DocumentRoot "c:/webfolder/external"
<Directory "c:/webfolder/external">
allow from all
order allow,deny
AllowOverride All
</Directory>
</VirtualHost>

Comments

Popular posts from this blog

Basic Send Message to MQ with Java and IBM MQ JMS

Basic Receive Message to MQ with Java and IBM MQ JMS

Creating a simple Alert / Success Message with ASP.NET/VB using Bootstrap