index.php - Open into Store without redirect or moving whole cart to root directory

Hi, Friends,



I have a very easy solution to calling a site’s base URL location and opening into CS-Cart without having to

a) put an HTML redirect on the site’s ‘index.html’ page (bad for SEO’s),

b) or include a link to the store from the site’s ‘index.html’ page (one more mouse click),

c) or as some have suggested moving the whole CS-Cart folder contents into the root folder (very messy and confusing.)



In other words: I want to type in www.mysite.com and go directly to my CS-Cart. rather than redirecting or linking it to www.mysite.com/cs-cart/index.php



SOLUTION:

  1. Copy (not move) the index.php residing in the CS-Cart folder to the root folder.
  2. Edit the copied ‘index.php’ file (the one in the root folder) and change 2 lines of code to accommodate the change in path. Make sure you revise the path of ‘prepare.php’ and ‘init.php’ to reflect the directory path as to where they reside in CS-Cart



    // changing directory from ‘./prepare.php’; to ‘cs-cart/prepare.php’;

    // changing directory from ‘./init.php’: to ‘cs-cart/init.php’;


    require ‘cs-cart/prepare.php’;

    require ‘cs -cart/init.php’;



  3. Rename your current ‘index.html’ or ‘default.html’ file found in the root directory to ‘index-old.html’ or ‘default-old.html’ so that the new ‘index.php’ will be recognized as the new site index file



    Congratulations, you have now with minimum effort reconfigured your site to automatically enter CS-Cart when you call it.



    What is nice is that the copy of ‘index.php’ in your root directory will retain any changes you make in altering the original home page in the Admin Panel → Design → Site Layout except for one thing – pictures.



    If you have included pictures in the ‘Text Displayed On The Store Home Page’, you must place and link to those pictures in a folder in CS-Cart (ie. /cs-cart/myhomepgpics). Then you must Copy (not move) that folder into the root directory so that the link from the ‘cs-cart/index.php’ to the pictures is mirrored in the link from the root folder/index.php to the pictures.



    For example:

    Make folder ‘cs-cart/myhomepgpics/’

    Upload your pics in this folder

    From the “Text Displayed on the Store Home Page” code, make sure you link to the pics in ./myhomepgpics/'

    Copy the folder ‘cs-cart/myhomepgpics’ to ‘/myhomepgpics/’

    YOU ARE NOW IN BUSINESS



    How does it work?

    Since we copied the cs-cart’s ‘index.php’ into the root directory and substituted it for our old ‘index.html’ file, when we type in our web-site’s URL we are taken to ‘index.php’.

    Since we altered the 2 references to ‘prepare.php’ and ‘init.php’ within ‘index.php’ to include the files in the CS-Cart Folder, it uses the info stored in CS-Cart to create the page.

    Any link we now explore takes us into the cart – we can now see the URL reading www.mysite.com/cs-cart/

    Once we are in the cart, and go back to home page, we will be taken to the original ‘index.php’ file in CS-Cart – www.mysite.com/cs-cart/index.php?etc.



    An elegant solution to a problem that should have really been easily addressed in the development of the CS-Cart program, that is, we should be able to configure where we want to put our ‘index.php’ file (it should not be married to the CS-Cart folder)



    In peace,

    seeker

Great solution, seeker! This works beautifully. I’ve been trying to find a way around moving my whole cart for months. And you’re absolutely right - putting a redirect command in your index.html is a huge no-no when it comes to SEO. My stats have been terrible.



Thanks for the post and for the great detailed explanation.

Hope I’ve not totally missed the point here, have you tried using a .htaccess file in root and use a 301 redirect?


redirect 301 / http://www.mysite.com/cs-cart/index.php



Not an SEO problem and a recommended approach. (More from Google Webmaster Central).

Much better solution – especially in keeping SEO’s happy.

Thanks to Seeker for the steps above. For the life of me, I couldn’t get my .htaccess files to work but I what was described above with index.php and now have my domain redirecting to the lower subdirectory.



I thought going live was supposed to be easy! It’s been anything but…

Stephanie

www.Products4Pets.com

I checked this solution now a little bit deeply. How look the other links, except the home link:



Example of a product link:


  1. [url]http://www.mysite.com/product-1.html[/url]



    or


  2. [url]http://www.mysite.com/cs-cart/product-1.html[/url]



    If it looks like example #2 after the modification, then I don’t see any advantages regarding SEO except that the home page link is shorter.



    The main reason to move your cart to the root should be increasing of SEF and SEO. In this case, it should remove the subfolder (cs-cart) name from the URL.

I couldn’t get my files ftp’d to the root in an effective manner, Indy, and really want to get my store up and running at this point. I may try addressing the issue at a later time but for now I’m going to leave it the way seeker described it. Is it really that bad to point SEO to a lower directory? I actually just had a hosted cart that was linked off my home page of my site and had pretty good ranking for many of my products considering I never paid for any PPC or paid anyone for SEO, either.



I guess I’m just frustrated because all of my ftp programs kept taking hours and hours to move the files to root and I couldn’t figure out why.



I may need to ask for help from someone or just wait until my hosting account updates to cPanel which should be soon. I’m hoping that will make it easier for me to move my files around on the server.



Regards,

Stephanie

www.Products4Pets.com

Sure, through a FTP program and slow connection, that can make some one tierd. With cPanel it can be done very quickly.



If your cart live in a subdirectory it doesn’t mean there is something BAD regarding SEO, but a root will be technically ever better. Sure that the results are not visible in a few days but maybe in a few months or years you will see your competitors about your position and maybe the one number of difference would be your subdirectory.



And it’s matter if you are on the place #4 or #3, because the CTR difference is huge.



Look at this: [URL]http://forum.cs-cart.com/showthread.php?t=13832[/URL]

Stephanie,



You could also send a support ticket to your hosting provider requesting them to move your CS-Cart folder to the root directory of your store.



They may not even charge you for this!



Other thing is that you will be far better off moving your store to the root now rather than leaving it in a sub-directory & then deciding some time down the road to move it to the root because then you will have to be concerned with whatever seo rankings you have gathered along the way.

Thanks, Struck! I may do that…they’re a very customer service oriented hosting company so I’m sure they will assist if I ask. They may even go ahead and update my account to cPanel since it will make life easier for me.



Regards,

Stephanie

www.Products4Pets.com - live on 2.0.8!!

If you run into this - best way to accomplish this by changing doucment_root for domain.

Here is detailed instructions for subdomain as well as primary domain.

https://www.servint.net/university/article/the-tech-bench-changing-a-document-root-in-cpanel/