Promotion: Search engines and PHP

started by Terryk on Jan 6, 2004 — RSS Feed

Terryk Terryk
Posts: 9

I'm in the process of installing a new shopping cart using PHP-based osCommerce for my online store.

My existing site (static HTML using a CGI script) gets excellent results in google, and I'm worried about whether/how those results will be affected when I migrate to a PHP, database-driven cart.

Though not a stock option with osCommerce, there is a modification that will generate the description and keyword META tags, but I don't know if that's enough. Will the search engines follow .php pages in the same manner as .html? If I use .htaccess to redirect my existing store pages to their new php URL, will that help my results? (As long as I don't delete any products, the product IDs should remain constant!)

Also, I'd rather not force cookie usage since they apparently causes problems for AOL users (a large part of my customer base), so there's a chance that the session IDs will end up being part of the URL when/if the robots spider the site. Is that a problem?

TIA for any comments.


Onizuka_design Onizuka_design
Posts: 1

I'd also really love an answer to this question...Thanks in advance!

Terakris Terakris
Posts: 23

Your PHP pages should get spidered fine, however any pages that require a variable sent in the URL that is not passed, could display some sort of error message that could then be listed in the search engine.

e.g. you go to from your page that sets an id.

if the spider comes in and looks at page.php and you dont pass it your id then the page (if coded badly) could fall over and the spider may record the error message contents and show that when people search for your site.

Well thats my (unfortunate) experience in the past  

Id try to code the site a little more stable when it comes to the product codes. If you HAVE to remove one, you dont want your site falling over now do you!  

I would try not to pass too much info in the URL as this is where things can start to fall over. Try to code around this and put lots of validation/error handling in yoru page in case a varable is missing.



Mountie Mountie
Posts: 11

Hope this helps (half a year later).

As terakris said, error-handling is a must.  No error-handling, and your site can easily fall apart.

Some ideas I've seen used in the past for similar problems would be to have a product listing (page.php), and individual product pages (page.php?id=123).

Regarding the product IDs, you shouldn't have to worry about that, if your database is set up properly.  Each product ought to have a unique ID, regardless of whether you still carry it.  IDs should never be re-used for different products/items.

Of course, as terakris mentioned, you will need to pass variables from one page to the other.  There are three basic ways to do that: URL query strings, cookies, and forms.  I've coded pages in the past that pass info using form variable, and they can work quite well.  Have your script write hidden form inputs with values on the page, and then instead of having a regular link, link using a submit button or with Javascript.

(edit)Another thing is to place a robots.txt file in your site's root directory.  Most spiders will follow any restrictions placed in this file.  See The Web Robots Pages(/edit)

Good luck!

Mag Smith Mag Smith
Posts: 1

Hi This Magsmith want to introduced all of you about in Search Engine,Web Development,Software Development in PHP.
i think that's very good platform for the discussion on this topic .

You must login to reply