Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Changing Domain on OSCommerce site


jwebadgility

Recommended Posts

Fixing those two files to change the domain name from www. to shop. is certainly part of what needs to be done, but first, step back and decide if that's the right path to take. This is to be a subdomain containing the shop, rather than being in the primary domain? Is the shop currently in the root, or in /catalog (or some other subdirectory)? Will this confuse customers rather than help them? Since switching to a subdomain will likely involve moving your shop's installation directory, don't forget to update the file paths (not just the domain name) in the two configure.php files. What is the purpose of moving your installation? Do you want to keep your store totally independent of the rest of your site? If the store is installed into a /shop or /catalog subdirectory (a good practice, by the way), and customers don't like having to add /shop or /catalog to the URL, it's possible to rewrite the URL to silently jump them from the root / into /shop or /catalog. Later, when you add more applications to your site (each in its own subdirectory, never in the root!), you can remove the rewrite and write a custom Landing Page to introduce the site and provide a link to each application, without invalidating existing bookmarks. Bottom line: what exists now, and what are you trying to accomplish?

If your store has been in use for a while under www domain, search engines and customers will have links and page indexes to that domain. You want to redirect them in your .htaccess (or equivalent) file to your shop, so don't forget that. You don't want to lose your existing goodwill and rankings!

Link to comment
Share on other sites

This brings up a good point. Thanks for the reminder. Currently my shop resides at www.myshop.com/catalog. In doing this change to a subdomain, is it possible to move the /catalog contents up to the root? This way when a user visits shop.myshop.com, they will be seeing the store immediately instead of me redirecting them into /catalog. Seems like it would be easy to do, but what I don't know if if any OSC settings need to change for this.

Link to comment
Share on other sites

While it's certainly possible to move an existing shop from /catalog to / root (or to /shop, the subdomain's root, for that matter), I advise against it. It is better to silently rewrite a visitor from / to /catalog, for two reasons: 1) it avoids disrupting an existing shop's bookmarks and search engine indexes, and 2) if you add another application (e.g., WordPress for a blog), your new applications will not have to pass through osC's /.htaccess, which can be a bear to untangle URL changes made for osC when your visitor is trying to get into WP. Nevertheless, if that's what you want to do, you can move all your files to the new directory tree, update the configure.php files as if it were a fresh installation (both domain name and full filesystem paths), and try to do something about redirecting (301) old customer bookmarks and search engine references to the new location.

I give this advice to help you future-proof your site and make it easy to install additional applications, with a root Landing Page. Otherwise, it will be more difficult than necessary to in the future add applications such as WordPress, if osC is already sitting in the site root (not necessarily the subdomain root). Now, going to a subdomain will be little different than leaving your store in /catalog -- in fact, depending on how flexible your hosting control panel is, you might simply be able to point the new "shop" subdomain to the existing /catalog subdirectory structure, although your configure.php files will still need to be updated with the domain name change, and you'll still have to do something about helping visitors who come in on old bookmarks and search engine entries to get to the right place. I hardly think it worth it, but if that's what you want, it can be done. By the way, from a customer's point of view, they will be annoyed by having to add "shop." to the domain name, and many will simply continue to type "www.", which you will have to redirect anyway to your store, so nothing is gained.

Remember, when I say "silent rewrite", I mean a 200 status code "internal" rewrite, simply tacking "/catalog" onto the front of the URI if it isn't already there. It's local to the server, and the browser, visitor, or search engine doesn't see any change (no 30x bounce back to the source, and additional round trip). Be careful not to give the protocol and domain in such a rewrite, or most servers will automatically turn it into a 302 redirect, which does show up to the visitor. Note that all 30x redirects should be done (with L flag) before any 200 rewrites, so that SEO and other internal rewrites don't show up in the visitor's browser. Also note that all the osC- (or WordPress-) specific .htaccess code should be in /catalog/.htaccess or /blog/.htaccess, leaving /.htaccess to only handle common things, such as forcing https and www, and doing IP address blocking.

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...