Re: Search Engines

From: Date: Mon, 02 Apr 2001 04:09:57 +0000
Subject: Re: Search Engines
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-46551@lists.php.net to get a copy of this message
"Joe Montiel" <wmjoe@yahoo.com> wrote: > I am new to the list and to php...I would like to know how php does with the > major search engines. Do I need to do something extra to make it work? Will > it index if I am pulling my content from text files? PHP produces HTML output which is sent to a browser, spider, etc. Everything else being equal about content on a webpage, a PHP generated file and a static HTML file are identical, with the possible exception of the file extension. There are a few "gotchas". A search engine can recognize a .php* file extension and assign it a penalty, though I'm not aware of this happening. If that's a fear you can always configure your webserver to parse .html files using PHP. Some search engines will ignore or penalize webpages with query strings in them (query strings are variable-value pairs following a "?" after the webpage name). The logic for this makes sense since a lot of pages like that are dynamically generated and a search engine will be less effective if it indexes a page and a few days later a user does a search, it appears in the results and the user goes there and the page no longer exists or contains different content than was indexed. An easy way around this (at least in Apache) is to create dynamically generated webpages that appear static. This can be accomplished by using AliasMatch lines in your Apache config. file to point a group of URLs (such as all beginning with '/books/') to a single PHP file. Then within the PHP file use a combination of regular expressions and environment variables (among other solutions) to pull the proper content from a file or database. For example if you have a URL like '/books/516.html' you can do: eregi( '^/books/(.*).html', $SCRIPT_URL, $regs ) ) // $regs[1] will contain '516'. // Grab record from database with id 516. Offhand, the only other things to watch for are don't do fast meta redirects (or any redirects at all) and if your PHP file hasn't been updated in months, but the database data it pulls from has updated recently, it's likely that browsers and spiders may think their cached copies of your webpage are current. A solution is to use a combination of header() functions like: header( "Last-Modified: " . gmdate( "D, d M Y H:i:s" ) . " GMT" ); Making your webpages appear at the top of search engines for your desired search phrases is another story. Though I live talking about search engine optimization strategies and steps, this isn't the right forum for giving away all of the secrets. <smile> -- Steve Werby President, Befriend Internet Services LLC http://www.befriend.com/

« previous php.general (#46551) next »