Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

How to redirect main domain to store directory


Guest

Recommended Posts

INTRODUCTION:

 

osCommerce store owners frequently install the package in some other directory and not as the domain root. So, the inevitable question arises of how to properly redirect to the store directory (assuming there is not content in the document root).

 

The majority of owners will use improper techniques for redirecting.

 

REFERENCE:

RFC 2616 - Hypertext Transfer Protocol -- HTTP/1.1

 

SOLUTION:

There are 2 recommended solutions and the store owner's implementation will be determined by whether they are hosted on an IIS or Linux based server and also whether FrontPage extensions are used for web maintenance.

 

Case: Store owner is on a Linux server and does not have FrontPage extensions

 

In .htaccess located in the document root paste this code and save the file:

Redirect permanent /index.php http://www.storedomain.com/catalog/index.php

Care needs to be taken to ensure that "storedomain.com" and "catalog" are the current settings for the store owner's installation.

 

Case: Store owner is on a Windows server and / or uses FrontPage extensions

 

PHP can be used to send the proper headers and redirect. Create a file called "index.php" and save it to the document root. Place this code in the file:

<?php
$goto = "http://www.storedomain.com/catalog/";
header("HTTP/1.0 301 Moved Permanently");
header ("Location: $goto");
?>

Once again, ensure current settings are used for the URL.

Link to comment
Share on other sites

So sorry, but I don't understand the reason(s) for the delay in serving the right content right away from the start, pls explain.

 

Is it not more logic to move the /catalog/ content up to root and adjust 2 configure.php's?

 

And BTW there are even more SE friendly methods.

"If you're working on something new, then you are necessarily an amateur."

Link to comment
Share on other sites

So sorry, but I don't understand the reason(s) for the delay in serving the right content right away from the start, pls explain.

 

Is it not more logic to move the /catalog/ content up to root and adjust 2 configure.php's?

 

And BTW there are even more SE friendly methods.

What would be a more SE friendly method of redirecting?

Link to comment
Share on other sites

What would be a more SE friendly method of redirecting?

No redirecting involved, just using another method of getting to /(catalog)/.

But pls. first let's try not to stray off from your original subject in the thread.

Can we get back to my 2 questions regarding the subject?

"If you're working on something new, then you are necessarily an amateur."

Link to comment
Share on other sites

It may be easier for you and I but 98% of the problems on this board are "How do I change the welcome text?". Which do you think THEY will be able to handle easier? Moving the catalog to the root or editing one line of code in one file?

 

The knowledge base is a collaborative effort to answer some of the most asked questions. This is one topic that is not covered but should be for those not so familiar with webmastering / PHP / .htaccess / coding / server administration.

 

Besides, there is no perceived lag time for presentation of content. In addition, it may be desireable to add content to the document root at a later time.

 

Now, back to my question to you: what is a more SE friendly method?? I don't think there is one...

Link to comment
Share on other sites

It may be easier for you and I but 98% of the problems on this board are "How do I change the welcome text?".  Which do you think THEY will be able to handle easier?  Moving the catalog to the root or editing one line of code in one file?
Posters (98%?) who do not even know how to change your text (How do I ...) should first follow a HTML crash course for at least one day before attempting to install DB-software like osCommerce.

 

And if they succeeded in installing in /catalog/ I don't see why installing in the root, or moving to the root, would pose a problem given a few pointers.

 

Besides, there is no perceived lag time for presentation of content.  In addition, it may be desireable to add content to the document root at a later time.
The principal objection IMO is the fact that most SE (Search Engines) don't like redirect :(

 

Now, back to my question to you: what is a more SE friendly method?? 

I don't think there is one...

Many times there are more ways to do things :D (my experience also) maybe you like my solution, no magic involved.

 

Use a "real browser", good ones are Mozilla or FireFox, goto the online website,

in the browser click top left on: File,

and in the menu click on: Save page as (CTRL + S), choose

1: - Filename: index.php.htm (it's there already) and

2: - Save as type: Web Page, complete (from the 4 possibilities).

Remmeber where the files are located on your local HDD.

 

Transfer the two saved items; the file: index.php.htm and the directory: index.php_files from their temp location on your PC to your online root :D

"If you're working on something new, then you are necessarily an amateur."

Link to comment
Share on other sites

Posters (98%?) who do not even know how to change your text (How do I ...) should first follow a HTML crash course for at least one day before attempting to install DB-software like osCommerce.

 

And if they succeeded in installing in /catalog/ I don't see why installing in the root, or moving to the root,  would pose a problem given a few pointers.

Maybe so...or, they could consult the knowledge base for a quick pointer on how to redirect with one line change in one file to redict. Isn't that what the knowledge base is for?

 

The principal objection IMO is the fact that most SE (Search Engines) don't like redirect :(

You are completely wrong. The search engines like proper redirects. Both of my suggestions use 301 headers and not 302 headers.

 

Many times there are more ways to do things :D  (my experience also) maybe you like my solution, no magic involved.

 

Use a "real browser", good ones are Mozilla or FireFox, goto the online website,

in the browser click top left on: File,

and in the menu click on:  Save page as (CTRL + S),  choose

1: - Filename:  index.php.htm (it's there already) and

2: - Save as type: Web Page, complete (from the 4 possibilities).

Remmeber where the files are located on your local HDD.

 

Transfer the two saved items; the file: index.php.htm and the directory: index.php_files  from their temp location on your PC  to your online root  :D

What about the SID that will be needed for those that do not have cookies enabled? Remember, IE by default now has cookies disabled which is a large number of web users.

 

What about being tagged by search engines for duplicate content?

 

Do you really think this is a better suggestion than a one line, one file modification?

Link to comment
Share on other sites

Isn't that what the knowledge base is for?
This new unrelated point in the thread does not need my reaction.

 

You are completely wrong.  The search engines like proper redirects.  Both of my suggestions use 301 headers and not 302 headers.
You're entitled to a opinion :)

I know am convinced and sure that SE like content more than redirects and untill this very moment I know that they have no problems with my solution, YMMV.

 

Do you really think this is a better suggestion than a one line, one file modification?

The best solution I gave already, put the shop where it belongs: in the root.

All other solutions are worse.

 

And BTW there was a third solution :D

"If you're working on something new, then you are necessarily an amateur."

Link to comment
Share on other sites

This new unrelated point in the thread does not need my reaction.

Unrelated? This forum is for suggesting entries to the knowledge base. It does not need your reaction since my post was written using the STICKY as a guide. Have you read the sticky?

 

You're entitled to a opinion :)

I know am convinced and sure that SE like content more than redirects and untill this very moment I know that they have no problems with my solution, YMMV.

Not an opinion...it's fact. Search engines like redirects more than they do duplicate content.

 

The best solution I gave already, put the shop where it belongs: in the root.

All other solutions are worse.

 

And BTW there was a third solution  :D

Given the caliber of your first suggetion I am curious of your next one. :)

Link to comment
Share on other sites

  • 1 month later...
This new unrelated point in the thread does not need my reaction.

 

You're entitled to a opinion :)

I know am convinced and sure that SE like content more than redirects and untill this very moment I know that they have no problems with my solution, YMMV.

 

The best solution I gave already, put the shop where it belongs: in the root.

All other solutions are worse.

 

And BTW there was a third solution  :D

 

John,

 

You are to harsh on this ! Even if it might be better/wiser to have your osC shop into the root there are circumstances this isn't possible on short notice, or never, and a good redirect is what is needed. My old shop resides in the root and I will have to keep everything there for I suppose a half year longer after I have taken my new osC shop into action. All my hard earned links in Google and many other search engines I don't like to loose by simply removing my old shop and people coming through Google to find NOTHING and just leave probably for ever.

I am glad I found this thread which gives me a hand in how to do it properly and my hosting being on Linux with no frontpage extensions I now know what to do (thanks for the info Chemo).

 

As this goes beyond my experience/knowledge (I would have simply used a redirect through the HTML header which I understand would be no good) you two just quarrel a bit more about it and maybe find even a better solution <_<

Link to comment
Share on other sites

  • 1 year later...

Case: Store owner is on a Windows server and / or uses FrontPage extensions

 

PHP can be used to send the proper headers and redirect. Create a file called "index.php" and save it to the document root. Place this code in the file:

<?php

$goto = "[color=#000099]http://www.storedomain.com/catalog[/color]/";

header("HTTP/1.0 301 Moved Permanently");

header ("Location: $goto");

?>

[/code B) ]

Once again, ensure current settings are [color=#333399]used for the URL[/color].

 

This is a very useful comment but would google have any trouble visiting my store if it is redirected like that???

I would be really thankful for an answer.

Link to comment
Share on other sites

New file called index.php, in your root folder. Contents:

 

<?php echo catalog/index.php ?>

 

works just as well!

 

And before all the ne'erdowells say that causes duplicate content trips and creates problems with the engines, no it doesn't, at least not in my personal experience. I have used this method on 7 different sites who for various reasons wanted to retain the directory hierarchy, and all rank very well in the engines, most of them for both the index.php and the catalog/index.php pages, although the worst case scenario is that one of the two doesn't show, but the other does. No biggy either way.

Link to comment
Share on other sites

sorry, was in muppet mode above, this one is what i meant to put!

File in root called index.php, contents:

<?php 
	echo file_get_contents ('http://www.yourwebsite.com/catalog/index.php'); 
?>

Link to comment
Share on other sites

  • 2 months later...
John,

 

You are to harsh on this ! Even if it might be better/wiser to have your osC shop into the root there are circumstances this isn't possible on short notice, or never, and a good redirect is what is needed. My old shop resides in the root and I will have to keep everything there for I suppose a half year longer after I have taken my new osC shop into action. All my hard earned links in Google and many other search engines I don't like to loose by simply removing my old shop and people coming through Google to find NOTHING and just leave probably for ever.

I am glad I found this thread which gives me a hand in how to do it properly and my hosting being on Linux with no frontpage extensions I now know what to do (thanks for the info Chemo).

 

When you move your shop, leave the old one at the old location, possibly with the old database.

Change the URLs in your includes/configure.php to your new site.

 

someone coming with an old link will see your old site, but ALL LINKS in the old site will point to your new site, ...and the spiders too.

yo can see it at www.schirmer-mosel.de/catalog

look at all links, they all point to schirmer-mosel.germanartbooks.de

 

I did not change anything in the code to achieve tis, only the configure.php

 

by the way, when you move you must keep the old content for more than two years... I still have about 30 errors 404 an hour with ooooold files from 2003 and older. :'(

I have also a custom 404.html to redirect everything to the main pages, after 15 seconds.

spiders don't like immediate redirects . B)

 

why doesn't google clean-up it's database?

:angry:

 

Michel

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...