0

So I have a regular PHP page which includes the header, body, and the footer.

So

<?php include('header.html');
?>
So header.html has <html>... content </html>

Same with Footer.html

and the index.php has one <html>Tag too.</html>

So is this bad for SEO or something else?

How to fix it?

Thanks.

2
  • 2
    Why don't you just remove the <html> tags from the pages? Mar 18, 2011 at 11:21
  • PHP has absolutely nothing to do with SEO.
    – Gordon
    Mar 18, 2011 at 11:21

3 Answers 3

3

Search engines will see exactly what the browser sees. So they know as much about your includes as the user: Nothing.

However, according your question your HTML code is horribly invalid as it seems to look like that:

<html>header stuff</html>
<html>page stuff</html>
<html>footer stuff</html>

Your templates should be like that:

header:

<html><head>...</head><body>some common content stuff for all pages

content:

some stuff for your body

footer:

some common content stuff for all pages</body></html>
0
1

It's bad for everything, not just SEO, because its plain wrong HTML.

You fix it by removing the invalid elements (<html> tags) from the includes.

Check the resulting page with a validator to find more such errors: http://validator.w3.org

-1

Well, it is invalid HTML. So I wouldn't be surprised if you are penalised in search results because of this.

How to fix? Just get rid of the <html> tags that aren't needed...? You only need one opening and one closing <html> tag on a HTML document.

2
  • Search engines, especially Google care very little about valid HTML. See the recent video: youtube.com/watch?v=2XlKn6I9rSc Mar 19, 2011 at 8:46
  • You're quite right - I just logged in to my Google Webmasters account and read the following: "When Googlebot crawled your site, it found some issues with your content. These issues won't prevent your site from appearing in Google search results, but addressing them may help your site's user experience and performance."
    – Matt Healy
    Mar 19, 2011 at 9:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.