Forums / Installing on a Windows Server / redirecting a domain to subdomain - help needed

redirecting a domain to subdomain - help needed

Started by yanxin on 25 Mar 2014, 7:30 AM · Views: 2,367

Results 1 to 12 of 12
25 Mar 2014, 7:30 AM
#1
yanxin avatar

yanxin

New Zenner

Join Date:
Feb 2014
Posts:
10
Plugin Contributions:
0

redirecting a domain to subdomain - help needed

hi

i have bought a new domain and i want it to point to my zencart store which is installed on a subdomain. i have already added the redirect through cpanel and also edited the part of the configure.php file:

define('HTTP_SERVER', 'http://www.mydomain.com');
define('HTTPS_SERVER', 'https://www.mydomain.com');

it redirects to the subdomain but the subdomain is still showing in the web address bar.

i didn't have this problem on my old store which was with another host and it was zen cart v1.39, i now have a new host and zen cart v1.51.

any help would be appreciated.

thanks

25 Mar 2014, 9:21 AM
#2
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: redirecting a domain to subdomain - help needed

yanxin:

hi

i have bought a new domain and i want it to point to my zencart store which is installed on a subdomain. i have already added the redirect through cpanel and also edited the part of the configure.php file:

define('HTTP_SERVER', 'http://www.mydomain.com');
define('HTTPS_SERVER', 'https://www.mydomain.com');

it redirects to the subdomain but the subdomain is still showing in the web address bar.

i didn't have this problem on my old store which was with another host and it was zen cart v1.39, i now have a new host and zen cart v1.51.

any help would be appreciated.

thanks

You need in your includes/configure.php and "admin"/includes/configure.php to change the
DIR_WS_CATALOG
and
DIR_WS_HTTPS_CATALOG

From /your_sub_domain/
To /

That will correct the redirect(s).
This will leave behind a single forward slash between the two single quotes.

This is only to be done in the two places of the two described files, do not remove it from elsewhere in the files.

ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...

25 Mar 2014, 12:15 PM
#3
yanxin avatar

yanxin

New Zenner

Join Date:
Feb 2014
Posts:
10
Plugin Contributions:
0

Re: redirecting a domain to subdomain - help needed

mc12345678:

You need in your includes/configure.php and "admin"/includes/configure.php to change the
DIR_WS_CATALOG
and
DIR_WS_HTTPS_CATALOG

From /your_sub_domain/
To /

That will correct the redirect(s).
This will leave behind a single forward slash between the two single quotes.

This is only to be done in the two places of the two described files, do not remove it from elsewhere in the files.

hi

i went to follow your steps but it seems like it is already like that by default, check below-

// NOTE: be sure to leave the trailing '/' at the end of these lines if you make changes!
// * DIR_WS_* = Webserver directories (virtual/URL)
// these paths are relative to top of your webspace ... (ie: under the public_html or httpdocs folder)
define('DIR_WS_CATALOG', '/');
define('DIR_WS_HTTPS_CATALOG', '/');

25 Mar 2014, 12:16 PM
#4
yanxin avatar

yanxin

New Zenner

Join Date:
Feb 2014
Posts:
10
Plugin Contributions:
0

Re: redirecting a domain to subdomain - help needed

hello, i went to do what you said, but it seems like it is already like that, see below:

// NOTE: be sure to leave the trailing '/' at the end of these lines if you make changes!
// * DIR_WS_* = Webserver directories (virtual/URL)
// these paths are relative to top of your webspace ... (ie: under the public_html or httpdocs folder)
define('DIR_WS_CATALOG', '/');
define('DIR_WS_HTTPS_CATALOG', '/');

25 Mar 2014, 12:59 PM
#5
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: redirecting a domain to subdomain - help needed

yanxin:

hello, i went to do what you said, but it seems like it is already like that, see below:

// NOTE: be sure to leave the trailing '/' at the end of these lines if you make changes!
// * DIR_WS_* = Webserver directories (virtual/URL)
// these paths are relative to top of your webspace ... (ie: under the public_html or httpdocs folder)
define('DIR_WS_CATALOG', '/');
define('DIR_WS_HTTPS_CATALOG', '/');

With HTTP_SERVER', 'http://www.mydomain.com' and the above, the store should appear as 'http://www.mydomain.com

Assuming that the cPanel actions were performed properly to point to the subdirectory that contains your store when http://www.mydomain.com is entered. Off the top of my head I do not know what it would take to have that action occur, but it appears to be an issue with setting up the cPanel portion.

Haven't described a problem related to this, but your file path(s) do include the subdirectory still correct? (Should include the subdirectory there, but should be omitted from the above area(s).

Oh, it could also be something in the .htaccess file(s). Should have a unique htaccess file in the sub-domain folder.

ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...

26 Mar 2014, 1:22 AM
#6
yanxin avatar

yanxin

New Zenner

Join Date:
Feb 2014
Posts:
10
Plugin Contributions:
0

Re: redirecting a domain to subdomain - help needed

mc12345678:

With HTTP_SERVER', 'http://www.mydomain.com' and the above, the store should appear as 'http://www.mydomain.com

Assuming that the cPanel actions were performed properly to point to the subdirectory that contains your store when http://www.mydomain.com is entered. Off the top of my head I do not know what it would take to have that action occur, but it appears to be an issue with setting up the cPanel portion.

Haven't described a problem related to this, but your file path(s) do include the subdirectory still correct? (Should include the subdirectory there, but should be omitted from the above area(s).

Oh, it could also be something in the .htaccess file(s). Should have a unique htaccess file in the sub-domain folder.

hi

yes i did cpanel redirect and the 2 methods above but no luck.
the htaccess file in the subdomain folder is blank..
also what do you mean about filepaths containing subdirectory? can you give me an example.

thanks alot

26 Mar 2014, 4:21 AM
#7
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: redirecting a domain to subdomain - help needed

yanxin:

hi

yes i did cpanel redirect and the 2 methods above but no luck.
the htaccess file in the subdomain folder is blank..
also what do you mean about filepaths containing subdirectory? can you give me an example.

thanks alot

So, let's go with the assumption that the name you had chosen for your new servername is:
define('HTTP_SERVER', 'http://www.yoursite.com');
define('HTTPS_SERVER', 'https://www.yoursite.com');

your previous/existing servername is:
define('HTTP_SERVER', 'http://www.mysite.com');
define('HTTPS_SERVER', 'https://www.mysite.com');

In both cases you want the site to show as in the root of the above server name so:
define('DIR_WS_CATALOG', '/');
define('DIR_WS_HTTPS_CATALOG', '/');

For the original site (https://www.mysite.com) the FS CATALOG might be something like:
define('DIR_FS_CATALOG', '/var/users/webserver/public_html/');

Then you have the yoursite location that is in a subdirectory off of public_html, even though it will be a "different" server, it is still in the same file structure as the mysite location, so the new site would have a file structure of.

define('DIR_FS_CATALOG', '/var/users/webserver/public_html/yoursite/');

So, it is this last part is what I was referring to about having file paths containing the subdirectory.

Although much is missing, the yoursite configure.php file would include/contain.
define('HTTP_SERVER', 'http://www.yoursite.com');
define('HTTPS_SERVER', 'https://www.yoursite.com');
define('DIR_WS_CATALOG', '/');
define('DIR_WS_HTTPS_CATALOG', '/');
define('DIR_FS_CATALOG', '/var/users/webserver/public_html/yoursite/');

The mysite configure.php would be like:
define('HTTP_SERVER', 'http://www.mysite.com');
define('HTTPS_SERVER', 'https://www.mysite.com');
define('DIR_WS_CATALOG', '/');
define('DIR_WS_HTTPS_CATALOG', '/');
define('DIR_FS_CATALOG', '/var/users/webserver/public_html/');

ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...

26 Mar 2014, 10:05 AM
#8
yanxin avatar

yanxin

New Zenner

Join Date:
Feb 2014
Posts:
10
Plugin Contributions:
0

Re: redirecting a domain to subdomain - help needed

mc12345678:

So, let's go with the assumption that the name you had chosen for your new servername is:
define('HTTP_SERVER', 'http://www.yoursite.com');
define('HTTPS_SERVER', 'https://www.yoursite.com');

your previous/existing servername is:
define('HTTP_SERVER', 'http://www.mysite.com');
define('HTTPS_SERVER', 'https://www.mysite.com');

In both cases you want the site to show as in the root of the above server name so:
define('DIR_WS_CATALOG', '/');
define('DIR_WS_HTTPS_CATALOG', '/');

For the original site (https://www.mysite.com) the FS CATALOG might be something like:
define('DIR_FS_CATALOG', '/var/users/webserver/public_html/');

Then you have the yoursite location that is in a subdirectory off of public_html, even though it will be a "different" server, it is still in the same file structure as the mysite location, so the new site would have a file structure of.

define('DIR_FS_CATALOG', '/var/users/webserver/public_html/yoursite/');

So, it is this last part is what I was referring to about having file paths containing the subdirectory.

Although much is missing, the yoursite configure.php file would include/contain.
define('HTTP_SERVER', 'http://www.yoursite.com');
define('HTTPS_SERVER', 'https://www.yoursite.com');
define('DIR_WS_CATALOG', '/');
define('DIR_WS_HTTPS_CATALOG', '/');
define('DIR_FS_CATALOG', '/var/users/webserver/public_html/yoursite/');

The mysite configure.php would be like:
define('HTTP_SERVER', 'http://www.mysite.com');
define('HTTPS_SERVER', 'https://www.mysite.com');
define('DIR_WS_CATALOG', '/');
define('DIR_WS_HTTPS_CATALOG', '/');
define('DIR_FS_CATALOG', '/var/users/webserver/public_html/');

yes all settings are as you have stated.

i built the zenstore on a subdomain thinking i would purchase a seperate domain for it later which i have now done so but it won't work lol. i just don't like the subdomain showing in the url.

i think i am just going to have to back up my zenstore and restore it onto the domain directly, how about it?

thanks

26 Mar 2014, 10:24 AM
#9
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: redirecting a domain to subdomain - help needed

yanxin:

yes all settings are as you have stated.

i built the zenstore on a subdomain thinking i would purchase a seperate domain for it later which i have now done so but it won't work lol. i just don't like the subdomain showing in the url.

i think i am just going to have to back up my zenstore and restore it onto the domain directly, how about it?

thanks

Have you reached out to the tech support of either your hosting company or the company from which the domain was purchased? I assume you have or are playing with two domain names and not like a shared host domain name and just purchased the first domain name.

Ask them for some assistance, it may be that they can "fix" it. But if you have the above settings as described, ZC is setup to handle the correct path, but there is somethingabout the host that is still kicking in the sub-directory in the URI.

ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...

26 Mar 2014, 10:59 AM
#10
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: redirecting a domain to subdomain - help needed

What did you do in your cPanel to setup your new domain name to point to this new subdirectory?

Btw,I am thhinking that ZC may not like the setup currently in place because the one constant identifying the folder is not equal to the current subdirectory shown in the address bar.

From looking online about how to setup the situation you are trying, it looks like you need to change the destination for your new domain name in the domain management portion of your cPanel to point to your new subdirectory.

ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...

26 Mar 2014, 11:56 AM
#11
yanxin avatar

yanxin

New Zenner

Join Date:
Feb 2014
Posts:
10
Plugin Contributions:
0

Re: redirecting a domain to subdomain - help needed

i purchased a host and domain for example https://www.domain1.com and made a subdomain then installed zen cart on https://www.subdomain.domain1.com
then through the same host i purchased https://www.domain2.com and i want this to replace the entire https://www.subdomain.domain1.com

as for cpanel i went to domains>redirect> in here i selected permenant 301, selected the new domain and entered the subdomain. it does redirect to the subdomain but the url remains subdomain.

a couple of years ago, i had no issues, on my old host, i just had to do the configure.php edits and cpanel redirect, it was so easy.

i have emailed them, they responded with:

**you need to use .htaccess redirection to a folder not a name.

just edit your .htaccess and redirect to the zencart folder.**

i have asked them for more information on this.

26 Mar 2014, 12:15 PM
#12
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: redirecting a domain to subdomain - help needed

yanxin:

i purchased a host and domain for example https://www.domain1.com and made a subdomain then installed zen cart on https://www.subdomain.domain1.com
then through the same host i purchased https://www.domain2.com and i want this to replace the entire https://www.subdomain.domain1.com

as for cpanel i went to domains>redirect> in here i selected permenant 301, selected the new domain and entered the subdomain. it does redirect to the subdomain but the url remains subdomain.

a couple of years ago, i had no issues, on my old host, i just had to do the configure.php edits and cpanel redirect, it was so easy.

i have emailed them, they responded with:

**you need to use .htaccess redirection to a folder not a name.

just edit your .htaccess and redirect to the zencart folder.**

i have asked them for more information on this.

I would switch things around to have your new domain direct to the final path (same place thatsubdomain is pointing, then 301 redirect urold subdomain to the new domain name. Right now what the system is thinking is that the subdomain should be the thing to continue to exist, the new domain name just helps to get there.

That is if I understood the current configuration correctly.

ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...