View Full Version : PHP includes and SEO
NewbiusMaximus
March 29th, 2004, 03:07 PM
Are PHP includes bad for SEO purposes? I use a header, left nav, and footer include for one of my sites. My left nav include has a lot of linking and reciprocal linking....will spiders read these? If so, does it matter if the includes extensions are .inc instead of .php?
thanks,
Newb
redex
March 29th, 2004, 03:31 PM
php includes are server side, so the server preprocesses them BEFORE serving the page, only thing you could get dinged on is a .php extension and you could use rewrite to serve the extension as .html
on the other hand, java scripts are client side so any prices and med names you have in javea script will not be seen by the spider.
Most all my sites are templated with php includes for header nav and footer. I do OK.
FWIW
RxRob
March 29th, 2004, 03:37 PM
PHP only outputs what you tell it to. To see what a spider sees, just view the source of your webpage.
Your included filesshould have the php extention. Why? Because .inc files would be sent to the browser as plain text.
So, if your included file was like this:
<?php
mysql_connect('localhost','username','password');
mysql_select_db('mydatabase') or die( 'Unable to select database');
?>
...then you would want somebody getting the plain text version of it.
RxRob
March 29th, 2004, 03:43 PM
Also, make sure PHP doesn't add the session ID to the ends of your internal links.
And stay away from passed variables as much as possible:
http://www.domain.com/index.php?page=somepage&var=value&var2=value2
rollingpenguin
March 29th, 2004, 04:09 PM
> Also, make sure PHP doesn't add the session ID to the ends of your internal links.
Is there a PHP config setting I can set to toggle this on and off? I just today noticed that the index page for my site, when you first load it, links have the SID appended to each link. But then it just kind of... goes away...
Is it because of the use of session_start() that it goes away? Maybe session_start() + 1 trip to the server and your okay. But if I was being crawled G***le would just ignore it straight off, no trip to the server.
Any ideas?
NewbiusMaximus
March 29th, 2004, 04:43 PM
Man...thanks guys and or gals. I checked the source on the live site and sure enough it's there. Makes sense that it would be what the spider sees. I'm new to PHP and growing to like it....I may ask more questions smileys/smiley2.gif.
-Cheers
RxRob
March 29th, 2004, 05:40 PM
> Also, make sure PHP doesn't add the session ID to the ends of your internal links.
Is there a PHP config setting I can set to toggle this on and off? I just today noticed that the index page for my site, when you first load it, links have the SID appended to each link. But then it just kind of... goes away...
Is it because of the use of session_start() that it goes away? Maybe session_start() + 1 trip to the server and your okay. But if I was being crawled G***le would just ignore it straight off, no trip to the server.
Any ideas?
In php.ini change the 1 to a 0, so it looks like this:
session.use_trans_sid = 0
*edit* Make sure this line has a "1":
session.use_cookies = 1
Save it and restart Apache.
insanity
March 29th, 2004, 10:30 PM
Yup I also use php includes with no probs. If you're using a header to make sure you can have different Titles and Metas on each page you can put this code at the top of each content page:
<?php
$htmlhead="<title>Insert Title Here</title>
<meta name=\"Description\" content=\"Insert Description Here\">
<meta name=\"Keywords\" content=\"InsertKeywordsHere\">
";
include("header.php");
?>
The header.php being whatever you call your header.
Powered by vBulletin™ Version 4.0.3 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.