Totally Zenned
- Join Date:
- Mar 2004
- Posts:
- 651
- Plugin Contributions:
- 1
Things I learned about installing ZenCart on a sub-domain
I hope this helps someone.
After searching the forum for information about installing ZenCart on a sub-domain and trying many of the suggestions about copying, changing configuration files, etc.,
I eventually did a clean install of 1.3.8, on a sub-domain.
- CPanel, setup a new sub-domain name; sub-domain folder is automatically setup.
- CPanel, setup a new database.
- FTP ZenCart files to the new sub-domain folder (public_html/subdomain_folder).
- Browse to the sub-domain (www.subdomain.mysite.com) and ZenCart automatically starts the install process.
Sub-domain installation configuration file changes.
includes/configure.php
define('HTTP_SERVER', 'http://www.subdomain_name.mysite.com');
define('HTTPS_SERVER', 'https://www.subdomain_name.mysite.com');define('DIR_FS_CATALOG', '/home/user/public_html/subdomain_folder/');
define('DIR_FS_SQL_CACHE', '/home/user/public_html/subdomain_folder/cache');
admin/includes/configure.php
define('HTTP_SERVER', 'http://www.subdomain_name.mysite.com');
define('HTTPS_SERVER', 'https://www.subdomain_name.mysite.com');
define('HTTP_CATALOG_SERVER', 'http://www.subdomain_name.mysite.com');
define('HTTPS_CATALOG_SERVER', 'https://www.subdomain_name.mysite.com');define('DIR_FS_ADMIN', '/home/user/public_html/subdomain_folder/admin/');
define('DIR_FS_CATALOG', '/home/user/public_html/subdomain_folder/');
define('DIR_FS_SQL_CACHE', '/home/user/public_html/subdomain_folder/cache');
Post installation issues that came up.
Accessing ZenCart Admin
The initial visit to Admin from the completed installation page went fine and I spent quite a bit of time setting various options. However, I had problems with all subsequent visits.
After signing in (www.subdomain_name.mysite.com/admin/login.php), ZenCart actually logged me into the main site's admin (https://www.mysite.com/admin/index.php%29; this was possible because I used the same password. No matter what path changes I made in the Admin configuration file, I was never able to login to the sub-domain admin using www.subdomain_name.mysite.com/admin/ . I did several installs with the same results and eventually gave up and changed my bookmark to point directly to the subfolder (https://www.mysite.com/subdomain_folder/admin/) which works; without a problem.
SSL certificate
I have SSL certificate for mysite.com and thought it was fully qualified for the entire site. However, my browser threw up a warning about it; when going to www.subdomain_name.mysite.com.
That is NOT something I want a visitor to see!
And, caused me to wonder about PayPal, my affiliate program, and other things registered or linked to https://www.mysite.com.
Solution: Install in subfolder and use 'redirection'.
If you intend to install ZenCart in its own folder (shop, catalog, etc) or intend to have the appearance of a subdomain/subsite (as I will for members.mysite.com), the installation process is the same.
The first three steps from above are the same:
- CPanel, setup a new sub-domain name; subfolder is automatically setup.
- CPanel, setup a new database.
- FTP ZenCart files to the new subfolder (public_html/subfolder).
Start ZenCart from the subfolder to get paths in configuration files correct.
4) Browsed to the subfolder (https://www.mysite.com/subfolder/) and ZenCart automatically starts the install process.
Subfolder installation configuration file changes.
includes/configure.php
define('DIR_WS_CATALOG', '/subfolder/');
define('DIR_WS_HTTPS_CATALOG', '/subfolder/');define('DIR_FS_CATALOG', '/home/user/public_html/subfolder/');
define('DIR_FS_SQL_CACHE', '/home/user/public_html/subfolder/cache');
admin/includes/configure.php
define('DIR_WS_ADMIN', '/subfolder/admin/');
define('DIR_WS_CATALOG', '/subfolder/');
define('DIR_WS_HTTPS_ADMIN', '/subfolder/admin/');
define('DIR_WS_HTTPS_CATALOG', '/subfolder/');define('DIR_FS_ADMIN', '/home/user/public_html/subfolder/admin/');
define('DIR_FS_CATALOG', '/home/user/public_html/subfolder/');
define('DIR_FS_SQL_CACHE', '/home/user/public_html/subfolder/cache');
Completing the redirection process.
- Using CPanel, setup re-direction of sub-domain to subfolder
from www.sub-domain.mysite.com
to https://www.mysite.com/subfolder/
- If you choose to install your core site in subfolder 'shop', you would have two redirections
from https://www.mysite.com
to https://www.mysite.com/shop/
from www.shop.mysite.com
to https://www.mysite.com/shop/
If you installed your core site in a subfolder you actually have several choices.
A) Leave redirection as shown.
B) If site is actually a HTML gateway to your 'shop', the first redirection is not appropriate.
C) If you don't want a sub-domain hanging around and confusing the issue, in CPanel remove the sub-domain name and don't bother with the second redirection.
Advantages I think I have by doing redirection to a subfolder.
-
All those additional functions (SSL, PayPal, affiliate program, etc.) are site specific; not folder specific. I may have dodged a few bullets and avoided some potential problems.
-
Having related, but different, sites up and running was important to me. It was NOT important if 'members' comes before or after the 'mysite' name in the address window. And, I don't think the customer cares either. As a sub-domain, the URL is valid across the net and I can market the 'members' site (https://www.members.mysite.com) separate from my main site.
-
Having the sub-site in its own 'root' folder allows easier FTP backups of the site. When the 'public_html' is the root, you have a bunch of other stuff there, too.
-
Additional sub-sites can be mirrored (using CPanel's 'file manager') from this one folder and be up and running in minimum time.
Juxi Zoza