Forum Moderators: coopster
I have been doing SEO and marketing for awhile now, and am fairly familiar with google.
I am just starting to work with developers who use php, and can definitely see some benefits in using it, but am not sure of all of the capabilities that it offers.
I have read that PHP "breadcrumbs" are great for google, and I'm sure that PHP nav menus are MUCH better for good rankings than javascript menus or even image maps. I like the possibilities that these offer, and every little bit definitely helps.
Can anyone suggest any other google friendly techniques that are unique to PHP?
PHP runs completely on the server and is never sent to the client. Because PHP can generate HTML and JavaScript output (as well as others), it is not accurate to say that PHP navigation is better than JavaScript or image maps since PHP can create JavaScript navigation or image maps as well as plain HTML.
So there is nothing inherent in PHP content that would make it rank better in Google than any client-side language, because it is not seen by Google, other bots, or browsers.
PHP does, however, make it possible to allow dynamic content based on a variety of conditions such as user input or current date and time, to name a couple. It can also be great for maintaining a template section of a site, such as 50 pages of articles where each page is the same except the content. This way formatting or navigation changes can be made by changing one script instead of 50 individual static pages.
Feel free to ask any specific questions you may have about PHP capabilities though :-).
Can anyone suggest any other google friendly techniques that are unique to PHP?
Session Variables - Google doesn't spider pages with session variables.
Coding with PHP you can check the user agent, and if the useragent=GoogleBot, for example, you can tell php not to create session for that user, therebye making that page spiderable. (thanks to Nick_W for that one)
For example on one site I have www.example.com/product-31.html as a URL, but it's dynamicaly generated by a php script. This is instead of www.example.com/products.php?productid=31 .
The way I do it is in Apache's httpd.conf, I have DocumentRoot /var/www/logic.php. All requests to the site are now handeled by logic.php. This logic.php then looks at the varible $_SERVER['REQUEST_URI'] and works out what page to show. ( there are other ways to do this, you can use Alias /path /var/www/script.php in a .htaccess too I think ).
For those wishing to do this static looking URL stuff, you may wish to turn off the expose_php directive otherwise it kind of gives the game away :)
Can I ask how do you turn off the expose_php directive? Can I do that in .htaccess?
I've seen the following thread [webmasterworld.com...] - does post #5 (by Yidaki) provide a real way to do this?
Cheers,
Red5.
PHP nav menus
This confuses a lot of people... unlike javascript, PHP is processed on the server. So all the browser or spider sees is the plain HTML your script created. To the browser/spider it's nothing moe than a static HTML page. With PHP it just so happens that you can customize the HTML on the fly before you send it -- but again, what gets sent is just an HTML page. Any processing happens behind the scenes and is completely invisible to the UA.
Digging deeper though, like the other posts mentioned, some common things to watch out for are:
- session IDs. That causes the spider to see a diff URL each time a page is revisited.
- long query strings, like index.php?namejoe&product=rug&itemNo=456&catalogNo=741
- The file extension itself: .php. Though not a problem, it is a dead giveaway that you are using PHP. If for any reason you want to disguise that fact then you'd need to rewrite the URLs, or use directory paths w/o file names.
HTH
I'm guessing the mod_rewrite is going to be the way I have to push them, and I know they are kinda dragging their feet by using session ids instead of cookies.
Could you point me to some information on how to NOT send a session ID to googlebot (or other bots for that matter)?
That sounds like it could be a way to help them out as well.
Check out this thread [webmasterworld.com] to cut the session idīs.