469,300 Members | 2,248 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,300 developers. It's quick & easy.

Is it bad for SEO to put PHP code inside the head tag?

194 100+
Hi Everyone,

I have some problem with SEO expert while arguing about PHP Code and Head tag.

I have included some PHP Code inside head tag like
Expand|Select|Wrap|Line Numbers
  1. <head>
  2. <?php
  3. include("includes/functions.php");
  5. if($_REQUEST['page']=='mypage')
  6. {
  7. then include meta tags according to the page name from the database.
  8. }
  9. ?>
  10. </head>
This is a CMS website and i have provided controls to add meta info at the admin panel of the website.

Now SEO expert is not happy with this as he is still insisting to remove any PHP code inside head tag of page. As i know Google Spider or Bot crawls rendered pages not PHP Code but im not able to give any reference to him. I have read Google Webmaster section and i did not found anything related to this issue.

My question is should i remove PHP code from inside of <head> tag?

Please advise me what should be the solution of this problem/issue.

Thanking you.
Dec 2 '10 #1
4 2527
1,206 Expert 1GB
I am with you on this one. The php tags should have no effect on SEO unless you are printing something that shouldn't be there. As far as spiders and bots go they do not see the server side code.

Does the SEO "expert" give a reason as to why they shouldn't be there?
Dec 2 '10 #2
194 100+
No, SEO "expert" never gave me any reason just kept asking me to remove any PHP code from inside of <head> tag. But now SEO "expert" agreed with me as i showed him your answer and he realized that Server Side Code can't be viewed by a BOT / Crawler.

Thank you for your reply.
Dec 7 '10 #3
according the search engine head tag is most important for the seo activity,so that most of the seo experts put site's title in the head tag.
Dec 17 '15 #4
5,058 Expert 4TB
It's worth pointing out, in this context, that most serious WordPress based sites use various SEO plugins to manage things like SEO related meta tags, which all happens through PHP code.

Just in case anybody ever needs something to point at, to shoot down this kind of nonsense from incompetent SEO "experts" :)
Dec 22 '15 #5

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

8 posts views Thread by Frances Del Rio | last post: by
1 post views Thread by Kevin | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
reply views Thread by harlem98 | last post: by
reply views Thread by harlem98 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.