Latest News: (loading..)

Archived

This topic is now archived and is closed to further replies.

isumitg

Moving osCommerce from one directory to another

10 posts in this topic

All my "catalog" files are in http://example.com/catalog folder. In other words, the complete website is in <webroot>/catalog folder. To open my website, one has to open http://.com/catalog link instead of http://.com link.

 

I want to move complete website to <webroot> folder. In other words, I want to display my website when user enters only http://.com instead of http://.com/catalog

 

Please answer the following questions:

 

1. What the things I need to take care? Will it work if I move it directly?

2. Do I need to change any configuration files? If yes, which configuration files I need to change?

3. What changes do I need to do in MySQL database?

Share this post


Link to post
Share on other sites

@@isumitg

 

1. What the things I need to take care? Will it work if I move it directly?

 

Move the contents of the /catalog/ directory to the / (root)

 

2. Do I need to change any configuration files? If yes, which configuration files I need to change?

 

Edit the /includes/configure.php and the /admin/includes/configure.php files to remove any reference to the /catalog path.

 

3. What changes do I need to do in MySQL database?

 

There are not database changes required.

 

 

Chris

isumitg likes this

Share this post


Link to post
Share on other sites

Thanks you Chris @@DunWeb

 

Is there anything else required or only the above 3 mentioned points will do?

 

Thanks again.

 

@@isumitg

 

1. What the things I need to take care? Will it work if I move it directly?

 

Move the contents of the /catalog/ directory to the / (root)

 

2. Do I need to change any configuration files? If yes, which configuration files I need to change?

 

Edit the /includes/configure.php and the /admin/includes/configure.php files to remove any reference to the /catalog path.

 

3. What changes do I need to do in MySQL database?

 

There are not database changes required.

 

 

Chris

Share this post


Link to post
Share on other sites

@@isumitg

 

The only other thing that MIGHT need to be updated is the .htaccess file if you have an SEO URL's contribution installed. Again, you would change the redirect path from /catalog to /

 

 

Chris

isumitg likes this

Share this post


Link to post
Share on other sites

I want to move complete website to <webroot> folder.

DON'T DO THAT! It's bad policy to have a major application in the root directory, and even worse if you already have search engine listings and customer bookmarks with the old 'catalog' path. If you want to add a blog or forum or the like in the future, you're going to have a mess. It's always best to keep a major application such as osC isolated in its own directory subtree, so it can be added, deleted, updated, or edited without fear of breaking other applications.

 

In other words, I want to display my website when user enters only http://example.com instead of http://example.com/catalog

Quite reasonable request. Use .htaccess URL rewriting (assuming you're on an Apache server) to send vistors to (just) example.com over to /catalog. URLs coming in with the catalog already in them will be unaffected, so bookmarks, search engine results, and your configuration files are all unaffected.

RewriteEngine On
RewriteCond  %{REQUEST_URI}  ^/?$
RewriteRule  ^/?$  /catalog/index.php [L]

In the future, when you install other applications and write a custom landing page (with links to osC and other applications), you just remove the rewrite.

isumitg likes this

Share this post


Link to post
Share on other sites
DON'T DO THAT! It's bad policy to have a major application in the root directory,

 

What precedence has been set that makes you think that ??? IMO, websites are better crawled when in the root directory. [public_html]

 

I do agree however with your suggestion about rewriting if the site has SE ranking already in place.

 

 

 

Chris

Share this post


Link to post
Share on other sites

What precedence has been set that makes you think that ???

  1. When you install a major application into the root, its files get all mixed in with your .htaccess, error pages, robots.txt, favicon.ico, etc., making it very likely that when working on that application you will accidentally damage or erase these system files.
  2. If you later should choose to install another major application (e.g., a forum), it would have to go into its own subdirectory anyway, to avoid overwriting osC's files.
  3. If you later should choose to install another major application, osC's .htaccess may cause problems when trying to get to the other application. You may not be able to "back out" osC's URL rewrites and such in a lower level .htaccess.
  4. If in the end you later have to relocate osC (into a subdirectory), bang go all your customer's bookmarks and all your search engine juice.
  5. Having major applications completely separated mean that adding, deleting, or changing them has no danger of affecting other applications or your common system files (.htaccess, favicon, etc.).
  6. Putting all major applications into their own subdirectories, with their own .htaccess files, and a landing page (with links) or .htaccess URL rewrite (if you have only one application) means that an application never has to be moved, and doesn't step on other applications, whatever you end up doing with it.

Conclusion: it's always best to install and keep osC in its own subdirectory, such as /catalog or /store. That way, whatever you choose to do with your site in the future, it's minimally disruptive to your store (to install another application) and there will be minimal problems with later-added applications. You're future-proofed.

Share this post


Link to post
Share on other sites

@@DunWeb @@MrPhil Thank you for your suggestions. Very helpful.

 

I am confused. What to do? My website is not yet launched. I am going to launch it very soon. So there is no fear of Search Engine listings. Also I think I am never going to install forums (but might install other major application which I am completely unaware of right now).

 

Hi Chris, since Phil listed out the benefits of the sub-directory, could you please also suggest the benefits of keeping in root directory (such as crawling, as you were saying)? I will then carefully examine :)

 

Hi Phil, do you think there is any disadvantage of keeping it in a sub-directory?

 

My OS: CentOS

Server: Apache

 

Please let me know if more information is required. Thank you.

Share this post


Link to post
Share on other sites

@@MrPhil

 

1. When you install a major application into the root, its files get all mixed in with your .htaccess, error pages, robots.txt, favicon.ico, etc., making it very likely that when working on that application you will accidentally damage or erase these system files.

 

Rookie mistake and if you do this, you shouldn't be administering your own website anyway.

 

2. If you later should choose to install another major application (e.g., a forum), it would have to go into its own subdirectory anyway, to avoid overwriting osC's files.

 

This is a given, however I don't think ANY other application should be on the same hosting account as your ecommerce installation. It is a personal preference but I always keep carts installed on their own secure server.

 

3. If you later should choose to install another major application, osC's .htaccess may cause problems when trying to get to the other application. You may not be able to "back out" osC's URL rewrites and such in a lower level .htaccess.

 

Again, rookie mistake. If you can't get two programs to share an .htaccess file in the root, hire a developer to do it for you.

 

4. If in the end you later have to relocate osC (into a subdirectory), bang go all your customer's bookmarks and all your search engine juice.

 

Once osCommerce is in the root, there is no foreseeable reason to move it to a subdirectory but should you need to, then proper redirects in the .htaccess will prevent most SE losses.

 

5. Having major applications completely separated mean that adding, deleting, or changing them has no danger of affecting other applications or your common system files (.htaccess, favicon, etc.).

 

Again, this is a repeat but if you have installed osCommerce properly the first time, there is no reason to change it.

 

6. Putting all major applications into their own subdirectories, with their own .htaccess files, and a landing page (with links) or .htaccess URL rewrite (if you have only one application) means that an application never has to be moved, and doesn't step on other applications, whatever you end up doing with it.

 

This is the same as previous points.

 

 

CONCLUSION: If you install and configure your osCommerce installation correctly the first time then you should never have to move it and never have any problems as described above.

 

Phil, I know you are just highlighting some of the most common errors when installing osCommerce and don't take my reply personally, I know you are a professional, but there are three kinds of users.

  1. The user who wants to try to install thier store and will learn by thier mistakes and they really don't have anything to lose but personal time so it really doesn't matter how much they play with it and screw it up.
  2. The user who THINKS they know what they are doing but really shouldn't be trying to do anything on the internet other than play games on facebook.
  3. The user that hires a developer to do it correctly the first time !

 

 

All of the above is just my rant.....ignore it if you want to.....lol

 

 

 

Chris

isumitg likes this

Share this post


Link to post
Share on other sites

Well, there are lots of rookies out there who make all those mistakes, and then come to this forum for help in cleaning up the mess. For every "how do I move my store to the root so users don't have to type in ____" it seems I see an "I need to move my store into a folder". I'm just trying to keep noobs out of trouble by recommending that they keep everything cleanly and rigorously separated from the get-go. If they're expert enough to know exactly what they're doing, they don't need my advice!

Share this post


Link to post
Share on other sites