Zen Cart Logo
Forums / Basic Configuration / Root or subdirectory?

Root or subdirectory?

Views: 4,396

Results 1 to 20 of 28
12 Aug 2014, 01:27
#1
robbie269 avatar

robbie269

Zen Follower

Join Date:
Feb 2010
Location:
New South Wales, Australia
Posts:
228
Plugin Contributions:
0

Root or subdirectory?

There is a bit of conflicting advise about whether it is better to have your zen cart store in the root (public_html) or in a subdirectory such as /shop/ with a RewriteRule to get https://www.domainname.com to go to https://www.domainname.com/shop/.

RewriteRule ^index\.php$ /shop/ [L] 

I thought having it in a subdirectory made it easier for upgrades. Or is it better for performance and/or SEO to have it in the root?:unsure:

12 Aug 2014, 03:24
#2
robbie269 avatar

robbie269

Zen Follower

Join Date:
Feb 2010
Location:
New South Wales, Australia
Posts:
228
Plugin Contributions:
0

Re: Root or subdirectory?

Or is it better to change your domain root from public_html/ to public_html/shop/ ??

12 Aug 2014, 03:39
#3
mc12345678 avatar

mc12345678

Totally Zenned

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

Re: Root or subdirectory?

Here's my understanding of the various methods discussed. Running the default store has nothing to do with upgrading. By that I mean, there is no reason to plan where uput your live site to accomodate something about upgrading. How you build on it, yes, but not where it runs day-to-day. Ideally when upgrading, you leave your live site alone, build what will look like your new site, then make some changes to bring the new live site online. The specific details are addressed in other documents.

So, that one addressed.

I won't speak on the SEO part, I'm like a few others, there are those that state the importance of or not... Etc. But I will say, how many times should a visitor be sent on to the next location before they end up on the site? By that meaning, directing the url to a sub-directory via htaccess for example, really is pretty much a waste, also in part doesn't it seem odd to type in one address and land on another? Or for the address naming convention to change from location to location?

As for redirecting the uri to a sub-directory so that the guest doesn't know about it, but the store owner and host does, well works/makes it easy to have multiple sites run from the same server (has it's own issues) by each url pointing to a different sub-directory on the same machine (how much is comingled?) A potential downfall (or two) is is that an htaccess file at the root of the public_html will likely/possibly cause trouble on both sites, and 2 the potential security issue(s) of one individual having access to more than one site at a time.

That's just my take on it.

12 Aug 2014, 04:29
#4
robbie269 avatar

robbie269

Zen Follower

Join Date:
Feb 2010
Location:
New South Wales, Australia
Posts:
228
Plugin Contributions:
0

Re: Root or subdirectory?

mc12345678:

Here's my understanding of the various methods discussed. Running the default store has nothing to do with upgrading. By that I mean, there is no reason to plan where uput your live site to accomodate something about upgrading. How you build on it, yes, but not where it runs day-to-day. Ideally when upgrading, you leave your live site alone, build what will look like your new site, then make some changes to bring the new live site online. The specific details are addressed in other documents.
The only reason I thought it would be best would be to have the new site in say /shop_test/ and then it is easy to move it to the live store by simply changing the current live site directory to /shop_old/ and the new /shop_test/ to /shop/ (and changing the config files). No need to copy the new files to the root. Am I missing something? I currently have the redirect:

RewriteCond %{HTTP_HOST} ^MYDOMAIN\.com\.au$ [OR]
RewriteCond %{HTTP_HOST} ^www\.MYDOMAIN\.com\.au$
RewriteRule ^/?$ "http\:\/\/www\.MYDOMAINl\.com\.au\/store\/" [R=301,L]

Is this bad? I just don't know....

12 Aug 2014, 11:12
#5
mc12345678 avatar

mc12345678

Totally Zenned

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

Re: Root or subdirectory?

robbie269:

The only reason I thought it would be best would be to have the new site in say /shop_test/ and then it is easy to move it to the live store by simply changing the current live site directory to /shop_old/ and the new /shop_test/ to /shop/ (and changing the config files). No need to copy the new files to the root. Am I missing something? I currently have the redirect:

RewriteCond %{HTTP_HOST} ^MYDOMAIN.com.au$ [OR]
RewriteCond %{HTTP_HOST} ^www.MYDOMAIN.com.au$
RewriteRule ^/?$ "http://www.MYDOMAINl.com.au/store/" [R=301,L]

> Is this bad? I just don't know....

How to approach this question...

I took a look at the various instruction available in the FAQs. I saw the guidance to which you were referring that identified that it is probably easiest to simply rename directories. Another method refers to placing the store in maintenance mmode and copying over the files associated with the new site and to delete those files that nno longer exist for that version of the store.

So there are in a sense two ways to look at things. An easy way to perform the upgrade and the way to operate the store.

Ideally though, the uri for the store would actually point directly to the sub-directory (again there is a potential that the the root directory of the host which would be one directory above the site would contain an htaccess file that could cause trouble for the site.). This methodi believe  would require at least two uris, one that points to the host's public_html, the other that is used for the store that points to the sub-directory.  By pointing meaning that when www .mystore .com is entered, the store shows with that address in the browser, no sub-directory included.  This is different thn your current setup, which always shows "shop" as part of the path in the browser and at no time is it possible to host a site at the root of your host's file structure.

Generally speaking, the instructions available in the FAQ are written with the thought of providing a successful result for anyone that uses it.  In the case of the instruction referenced, all server side actions are identified as an example, not necessarily something that must be done. On the same note, it's easy to run a store without adding any functionality vailable from the plugins section or template changes, and there are those that go that way. So is it "wrong"? I'd say that it can be a matter of opinion,mostly because I do not have any empirical data to suggest it is.  I do see a lot of the others that provide support on this site as recommending that the store be in the root directory and thaat a redirect like above not be used.

So, may ask how I have done things? Unfortunately, the organization with which I work can be strongly polarized by emotion. We didn't even begin to consider a sales site until our base site had been online for almost a year.  At that point, we were happy to get something up, so yes we did place our store in a sub-directory, because a lot of work had gone into the base site... Now that those emotions have died down, politically it is a good idea for us to transition our store site to be our base site.  To keep the information available, we are working the base site information into our ZC site, and then the base site will be replaced with our store.  It *is* a bit of a slow process/not wanting to shock our customers mostly because there is a lot of thought going into placement and redesign, but it certainly is worth the replacement.  In the end our customers will be able to find the information that we provide as well as to be able to provide the donations that we need.
12 Aug 2014, 11:16
#6
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,065
Plugin Contributions:
56

Re: Root or subdirectory?

robbie269:

There is a bit of conflicting advise about whether it is better to have your zen cart store in the root (public_html) or in a subdirectory such as /shop/ with a RewriteRule to get https://www.domainname.com to go to https://www.domainname.com/shop/.

RewriteRule ^index.php$ /shop/ [L]

> I thought having it in a subdirectory made it easier for upgrades. Or is it better for performance and/or SEO to have it in the root?:unsure:
Having Zen Cart installed in a subdirectory makes it immensely easier for upgrades.  My preferred approach is as you indicated, install in a subdirectory and rewrite to "root".
12 Aug 2014, 12:06
#7
stevesh avatar

stevesh

Black Belt

Join Date:
Feb 2005
Location:
Lansing, Michigan USA
Posts:
19,793
Plugin Contributions:
2

Re: Root or subdirectory?

lat9:

Having Zen Cart installed in a subdirectory makes it immensely easier for upgrades.

Could you explain why ?

12 Aug 2014, 12:27
#8
mc12345678 avatar

mc12345678

Totally Zenned

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

Re: Root or subdirectory?

lat9:

rewrite to "root".

I'm curious about the rewrite aspect, is this typically an htaccess rewrite as identified by the OP, or a folder that the uri is "assigned" to, or some other method?

12 Aug 2014, 12:36
#9
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,065
Plugin Contributions:
56

Re: Root or subdirectory?

stevesh:

Could you explain why ?
When the Zen Cart is installed in a subdirectory, my normal approach to an upgrade is to create the upgrade as a peer directory. Once the upgrade is "ready for prime time", both sites go into Maintenance Mode, I rename the old directory and then rename the upgrade directory to the "live" directory. Site downtime, close to 0.

12 Aug 2014, 12:37
#10
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,065
Plugin Contributions:
56

Re: Root or subdirectory?

mc12345678:

I'm curious about the rewrite aspect, is this typically an htaccess rewrite as identified by the OP, or a folder that the uri is "assigned" to, or some other method?
Most hosts provide a means in the cPanel to associate a URL with a directory. Under-the-covers, this is a rewrite.

12 Aug 2014, 12:46
#11
mc12345678 avatar

mc12345678

Totally Zenned

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

Re: Root or subdirectory?

lat9:

Most hosts provide a means in the cPanel to associate a URL with a directory. Under-the-covers, this is a rewrite.

Based on this I offer a correction to what I wrote above a few posts back, a second uri need not be obtained, using the potentially offered cpanel "rewrite", one could have a single uri that points to a sub-directory in the overall path of files, this results in the customer seeing the uri that has been obtained and results in not having them see some sort of sub-directory. That, as used above is "under-the-covers" and known basically only to those having access to the file structure.

12 Aug 2014, 21:37
#12
robbie269 avatar

robbie269

Zen Follower

Join Date:
Feb 2010
Location:
New South Wales, Australia
Posts:
228
Plugin Contributions:
0

Re: Root or subdirectory?

Yes it does seem to provide the best of both worlds.

12 Aug 2014, 22:49
#13
robbie269 avatar

robbie269

Zen Follower

Join Date:
Feb 2010
Location:
New South Wales, Australia
Posts:
228
Plugin Contributions:
0

Re: Root or subdirectory?

lat9:

Most hosts provide a means in the cPanel to associate a URL with a directory. Under-the-covers, this is a rewrite.
Could you tell me how to do this?

13 Aug 2014, 12:47
#14
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,065
Plugin Contributions:
56

Re: Root or subdirectory?

Who provides your hosting service?

13 Aug 2014, 15:40
#15
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,065
Plugin Contributions:
56

Re: Root or subdirectory?

robbie269:

Could you tell me how to do this?
In a "standard" cPanel, you'll use Domains->Parked Domains.

13 Aug 2014, 22:09
#16
robbie269 avatar

robbie269

Zen Follower

Join Date:
Feb 2010
Location:
New South Wales, Australia
Posts:
228
Plugin Contributions:
0

Re: Root or subdirectory?

lat9:

In a "standard" cPanel, you'll use Domains->Parked Domains.
I use an Australian hosting company. I have some parked domains. I have them redirected to my main domain name.

13 Aug 2014, 22:24
#17
robbie269 avatar

robbie269

Zen Follower

Join Date:
Feb 2010
Location:
New South Wales, Australia
Posts:
228
Plugin Contributions:
0

Re: Root or subdirectory?

Another option I thought of was changing my main domain say example.com to one of my parked domains. Then example.com could become an add-on domain that I could point to the /shop/ subdirectory. Is that possible or advisable?

13 Aug 2014, 22:37
#18
mc12345678 avatar

mc12345678

Totally Zenned

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

Re: Root or subdirectory?

robbie269:

Another option I thought of was changing my main domain say example.com to one of my parked domains. Then example.com could become an add-on domain that I could point to the /shop/ subdirectory. Is that possible or advisable?

If I understand what you are saying, I think this was the idea that lat9 was getting at. Example.com becomes a parked domain that points to the directory shop off of your public_html directory. Would need to update your configure.php files to reflect that the uri is just example.com, thaat there is no subdirectory for the WS defines, but the FS defines would still need to keep public_html/shop portion.

13 Aug 2014, 23:02
#19
robbie269 avatar

robbie269

Zen Follower

Join Date:
Feb 2010
Location:
New South Wales, Australia
Posts:
228
Plugin Contributions:
0

Re: Root or subdirectory?

mc12345678:

If I understand what you are saying, I think this was the idea that lat9 was getting at. Example.com becomes a parked domain that points to the directory shop off of your public_html directory. Would need to update your configure.php files to reflect that the uri is just example.com, thaat there is no subdirectory for the WS defines, but the FS defines would still need to keep public_html/shop portion.
Just tried it with my test site. Used one of my parked domains to point to it and changed the configure.php as you suggested. Still had the primary domain and subdirectory in the address bar plus no templates loaded. Back to the drawing board....

13 Aug 2014, 23:10
#20
robbie269 avatar

robbie269

Zen Follower

Join Date:
Feb 2010
Location:
New South Wales, Australia
Posts:
228
Plugin Contributions:
0

Re: Root or subdirectory?

Just tried the same thing but as an add-on domain. And it worked! Now my problem is, do I really want my site to go down while I swap it all over???