Ad

PHP Code And It's Effect On SEO

- 1 answer

So in order to minimalize code and optimize speed of my website I have used much PHP code. I used it to contain the entirety of the header and footer of my website.

    <?php include('header.php') ?>
    ...Content...
    <?php include('footer.php') ?>

In doing so I had trapped the title meta-tag within a PHP file, so in order to change the Title for each unique page I used a PHP variable placed above the header to adjust it like so:

    <?php $title="Page Specific Title" ?>
    <?php include('header.php') ?>
    ...Remainder of site.

I have tested this out and it clearly works within the browser. However, now that I am looking into SEO for my website, I am curious.

Does using PHP to populate SEO related meta tags have a negative impact on the SEO of the page?

If so, my follow up question would be what way can I optimize the speed of the website without negatively impacting the SEO of the individual pages? Would JavaScript work or am I confined to HTML?

Thank you in advance for any that can help.

Ad

Answer

Search engines visit sites almost like a user, by which I mean a page is prepared by the server and sent to them. PHP is whats running on your server to create that page, including setting the title to the value of the variable. So what the search engine get is the output of your PHP with the variable replaced with the value.

So no, using PHP will not effect your SEO.

Ad
source: stackoverflow.com
Ad