Jump to content

  • You cannot start a new topic
  • You cannot reply to this topic

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

 
  • seeker
  • Junior Member
  • Members
  • Join Date: 24-Nov 09
  • 2 posts

Posted 24 November 2009 - 11:23 PM #1

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 '<site root>/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

 
  • tuari
  • Junior Member
  • Members
  • Join Date: 22-Aug 09
  • 40 posts

Posted 24 November 2009 - 11:42 PM #2

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.

 
  • kbrand
  • Junior Member
  • Members
  • Join Date: 01-Dec 06
  • 26 posts

Posted 06 December 2009 - 07:44 AM #3

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).

 
  • seeker
  • Junior Member
  • Members
  • Join Date: 24-Nov 09
  • 2 posts

Posted 07 January 2010 - 12:41 AM #4

Much better solution -- especially in keeping SEO's happy.

 
  • scase
  • Senior Member
  • Members
  • Join Date: 19-Dec 08
  • 294 posts

Posted 31 January 2010 - 07:18 PM #5

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

 
  • indy0077
  • Senior Member
  • Banned
  • Join Date: 03-Nov 09
  • 1431 posts

Posted 31 January 2010 - 07:50 PM #6

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

Example of a product link:

1) http://www.mysite.com/product-1.html

or

2) http://www.mysite.co.../product-1.html

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.
.
CS-Cart Professional €160.00 | CS-Cart Multi-Vendor €625.00 | CS-Cart Hosting | SSL Certificates
.
CS-Cart Optimized Servers *** USA & UK VPS Servers

 
  • scase
  • Senior Member
  • Members
  • Join Date: 19-Dec 08
  • 294 posts

Posted 31 January 2010 - 10:04 PM #7

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

 
  • indy0077
  • Senior Member
  • Banned
  • Join Date: 03-Nov 09
  • 1431 posts

Posted 31 January 2010 - 10:31 PM #8

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: http://forum.cs-cart...ead.php?t=13832
.
CS-Cart Professional €160.00 | CS-Cart Multi-Vendor €625.00 | CS-Cart Hosting | SSL Certificates
.
CS-Cart Optimized Servers *** USA & UK VPS Servers

 
  • Struck
  • Teetering on Genious
  • Members
  • Join Date: 07-Mar 09
  • 2502 posts

Posted 31 January 2010 - 11:55 PM #9

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.
Cooking with Gas on Version 4.1.2 (But proceeding with caution....)

 
  • scase
  • Senior Member
  • Members
  • Join Date: 19-Dec 08
  • 294 posts

Posted 01 February 2010 - 06:09 AM #10

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!!

 
  • 12ka4
  • Member
  • Trial users
  • Join Date: 21-Feb 18
  • 24 posts

Posted 18 May 2018 - 05:11 PM #11

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....root-in-cpanel/