How to do SEO in PHP based website?

When it comes to do SEO in PHP Based Website that is updating title tags, meta descriptions, canonical link elements, etc. on a page-by-page basis, we often rely on the power of the client’s CMS. Whether we’re using WordPress plugins or Drupal modules to get the job done, we generally have a process that is efficient and feasible. No tinkering with template files. No scouring the web for alternative solutions. Simple implementation – just the way we like it.

Content Management Systems with built-in SEO utilities are great. What happens, though, when you’re tasked with implementing all of the pertinent HTML elements page-by-page on a PHP based website with a static <head>? Let’s dive right in.

1. Make that <head> dynamic!

In most cases, each static PHP file, be it index.php, contact.php, what have you, will reference the same header.php file via an include statement:

<?php include(‘header.php’); ?>

1

<?php include(‘header.php’); ?>

The include statement tells the server that any code within header.php should also be included in the file being requested. This way, we don’t have to write a lot of the same HTML on every content page. Instead, we have this one static file from which we can pull the necessary code. Note that the header.php file doesn’t necessarily contain only the HTML <head>. Generally, it will include any code that is reusable at the top of the HTML document throughout the website (including the logo, navigation, banner, etc.). Let’s look at an example of code we might find in header.php:

<html lang=”en”>

<head>

<title>Page Title Here</title>

<meta name=”description” content=”Meta description goes here.”>

<link rel=”stylesheet” href=”style.css”>

</head>

<body>

<div class=”wrapper”>

. . .

<html lang=”en”>

<head>

<title>Page Title Here</title>

<meta name=”description” content=”Meta description goes here.”>

<link rel=”stylesheet” href=”style.css”>

</head>

<body>

<div class=”wrapper”>

. . .

How to do SEO in PHP based website?

This is a bit stripped-down, of course, but it’s serviceable. Notice, though, that our title tag and meta description have static text values. Even if we edit these to be a bit more descriptive of a particular page, we’ll be effectively applying the same title and meta description to every page on the website. Not good. Fortunately, we can make these dynamic values (unique to each page) by using PHP variables. We’ll use the echo construct to place the necessary page-level variables (which we haven’t yet created) in the right spots in header.php.

<html lang=”en”>

<head>

<title><?php echo $pageTitle; ?></title>

<meta name=”description” content=”<?php echo $pageDescription; ?>”>

<link rel=”stylesheet” href=”style.css”>

</head>

<body>

<div class=”wrapper”>

. . .

<html lang=”en”>

<head>

<title><?php echo $pageTitle; ?></title>

<meta name=”description” content=”<?php echo $pageDescription; ?>”>

<link rel=”stylesheet” href=”style.css”>

</head>

<body>

<div class=”wrapper”>

. . .

How to do SEO in PHP based website?

It’s safe to say that we’ll be implementing titles and meta descriptions on each page of the website. What about something like a canonical link element or meta robots markup, though? We might not want these on every page, but rather just select pages. To handle these elements, we’ll use a couple of conditional statements. If the canonical URL and/or robots content is defined for a given page, then we’ll include the element(s) in the <head>. If the condition within the parentheses is met, then the code within the brackets ({ … }) is executed.

<html lang=”en”>

<head>

<title><?php echo $pageTitle; ?></title>

<meta name=”description” content=”<?php echo $pageDescription; ?>”>

<?php

// If canonical URL is specified, include canonical link element

if($pageCanonical)

{

echo ‘<link rel=”canonical” href=”‘ . $pageCanonical . ‘”>’;

}

// If meta robots content is specified, include robots meta tag

if($pageRobots)

{

echo ‘<meta name=”robots” content=”‘ . $pageRobots . ‘”>’;

}

?>

<link rel=”stylesheet” href=”style.css”>

</head>

<body>

<div class=”wrapper”>

. . .

How to do SEO in PHP based website?

<html lang=”en”>

<head>

<title><?php echo $pageTitle; ?></title>

<meta name=”description” content=”<?php echo $pageDescription; ?>”>

<?php

// If canonical URL is specified, include canonical link element

if($pageCanonical)

{

echo ‘<link rel=”canonical” href=”‘ . $pageCanonical . ‘”>’;

}

// If meta robots content is specified, include robots meta tag

if($pageRobots)

{

echo ‘<meta name=”robots” content=”‘ . $pageRobots . ‘”>’;

}

?>

<link rel=”stylesheet” href=”style.css”>

</head>

<body>

<div class=”wrapper”>

. . .

Now that we have ourselves a <head> with elements that rely on page-defined variables, we’ve done most of the “hard” work. Let’s move on to defining these page-specific variables.

2. Define page-specific PHP variables

So, for each page on our site – all individual PHP files – we’ll need to define, at a minimum, two variables ($pageTitle and $pageDescription) before our include(header.php) statement. Ideally, we would write in some conditionals to catch cases where these variables aren’t defined; but for now, we’ll just be extra careful to define them on each page. We have the option of defining two additional variables ($pageCanonical and $pageRobots), as well. To define a variable, we use the syntax: $variable = “This is a string”;. Let’s go ahead and assign values to all four of our variables for the home page. We’ll be working with the index.php file. (The topic of our site is Orange Widgets).

<?php

// Define variables for SEO

$pageTitle = ‘Orange Widgets | The Best Orange Widgets’;

$pageDescription = ‘Visit https://theflashupdate.com to find the best orange widgets in all the lands (Oz included).’;

$pageCanonical =‘https://theflashupdate.com’

// We don’t want the search engines to see our website just yet

$pageRobots = ‘noindex,nofollow’;

// Include header file

include(‘header.php’);

. . .

How to do SEO in PHP based website?

?>

<?php

// Define variables for SEO

$pageTitle = ‘Orange Widgets | The Best Orange Widgets’;

$pageDescription = ‘Visit https://theflashupdate.com to find the best orange widgets in all the lands (Oz included).’;

$pageCanonical = ‘https://theflashupdate.com

// We don’t want the search engines to see our website just yet

$pageRobots = ‘noindex,nofollow’;

// Include header file

include(‘header.php’);

. . .

How to do SEO in PHP based website?

?>

Simple enough, right? We’ve defined our title, meta description, canonical URL, and meta robots content with four PHP variables. Let’s see what the top of the source code looks like for index.php.

<html lang=”en”>

<head>

<title>Orange Widgets | The Best Orange Widgets</title>

<meta name=”description” content=”Visit https://theflashupdate.com to find the best orange widgets in all the lands (Oz included).”>

<link rel=”canonical” href=”https://theflashupdate.com>

<meta name=”robots” content=”noindex,nofollow”>

<link rel=”stylesheet” href=”style.css”>

</head>

<body>

<div class=”wrapper”>

. . .

<html lang=”en”>

<head>

<title>Orange Widgets | The Best Orange Widgets</title>

<meta name=”description” content=”Visit https://theflashupdate.com” to find the best orange widgets in all the lands (Oz included).”>

<link rel=”canonical” href=”https://theflashupdate.com“>

<meta name=”robots” content=”noindex,nofollow”>

<link rel=”stylesheet” href=”style.css”>

</head>

<body>

<div class=”wrapper”>

. . .

How to do SEO in PHP based website?

Not too shabby, eh? While it might seem like a pain to declare these variables on a page-by-page basis, it’s really not much different than using All in One SEO for WordPress or something comparable for another CMS. Once you’ve familiarized yourself with the concepts outlined above, you’ll find that editing the files directly isn’t as taxing a process as you might have thought. For those of you working on small PHP-based websites, I highly recommend implementing the dynamic <head> elements we’ve discussed. What takes minutes to implement could yield years’ of worth.

Any cool tips or tricks when it comes to doing SEO for PHP-based websites/applications? Share ’em in the comments below!

To get the most recent plugins and Updates of Plugins, Please Visit https://cheaprateplugin.com

200+ Free Dofollow Web 2.0 Websites List 2019

below I have listed 200+ free Dofollow Web 2.0 websites list 2019. you will get good response from our marketer community and businesses. this  article hope helped them to enlist their businesses!

Web 2.0 is full free platforms for blogger and SEO experts i have listed below in my post you can get a full free do-follow backlink from here just got to this site and start a free blogging journey or create a high-quality do-follow backlink and improve your website visibility .

200+ Free Dofollow Web 2.0 Websites List 2019

Obtaining natural traffic is just one of the search engine optimization strategies to boost traffic and, finally, the page rank of a website or blog. There are actually many sources of natural backlinks, which are favoured by Google. here included the High Page Rank Dofollow Web 2.0 websites List. You understand, following these sites is a popular search engine optimization strategy in 2019.For more Dofollow Web 2.0 Websites List please drop the comment

Have a look at the following listing of 200+ Dofollow Web 2.0 Websites List in 2019 and a simpler method for building links for SEO purposes.

Web 2.0 Sites PR Alexa Rank
http://wordpress.com 9 38
http://blogspot.com 9 39
http://blogger.com 9 72
http://issuu.com 9 572
http://xing.com 9 1041
http://tumblr.com 8 41
http://www.tumblr.com/ 8 41
http://livejournal.com 8 191
http://wix.com 8 246
http://www.wix.com/ 8 246
http://weebly.com 8 271
http://www.weebly.com/ 8 271
http://goodreads.com 8 294
http://jimdo.com 8 584
http://academia.edu 8 734
http://sfgate.com 8 958
http://salon.com 8 1255
http://last.fm 8 1527
http://myspace.com 8 1672
http://my.opera.com 8 3726
http://storify.com 8 4377
http://merchantcircle.com 8 10682
http://www.merchantcircle.com/ 8 10682
http://citeulike.org 8 15288
http://friendfeed.com 8 29318
http://posterous.com 8 76703
http://groups.google.com 7 1
http://blog.fc2.com 7 54
http://blog.fc2.com/ 7 54
http://deviantart.com 7 212
http://rediff.com 7 365
http://www.rediff.com/ 7 365
http://evernote.com 7 397
http://evernote.com/ 7 397
http://box.com 7 569
http://zoho.com 7 690
http://www.zoho.com 7 690
http://www.zoho.com/ 7 690
http://gawker.com 7 904
http://typepad.com 7 1163
http://slashdot.org 7 1785
http://webs.com 7 2110
http://www.webs.com/ 7 2110
http://wikispaces.com 7 2240
http://diigo.com 7 2602
http://tripod.com 7 3053
http://calameo.com 7 4498
http://wikidot.com 7 4592
http://angelfire.com 7 5686
http://newsvine.com 7 7129
http://www.newsvine.com/ 7 7129
http://edublogs.org 7 7136
http://blox.pl 7 8103
http://angelfire.lycos.com 7 9126
http://tripod.lycos.com 7 9126
http://www.tripod.lycos.com 7 9126
http://bravenet.com 7 9537
http://www.yola.com 7 13762
http://getsatisfaction.com 7 15631
http://technorati.com 7 15853
http://youblisher.com 7 18857
http://jamendo.com 7 23740
http://blog.de 7 25424
http://keepandshare.com 7 36388
http://drupalgardens.com 7 39851
http://jumptags.com 7 59213
http://rhizome.org 7 92509
http://rhizome.org/ 7 92509
http://synthasite.com 7 121501
http://miarroba.com 7 149871
http://freewha.com 7 161165
http://couchsurfing.org 7 287104
http://www.couchsurfing.org/ 7 287104
http://quizilla.com 6 0
http://fc2.com 6 54
http://4shared.com 6 439
http://zing.vn 6 739
http://shutterfly.com 6 812
http://www.shutterfly.com/ 6 812
http://blog.pchome.com.tw 6 956
http://hubpages.com 6 1177
http://hubpages.com/ 6 1177
http://zimbio.com 6 1795
http://www.zimbio.com/ 6 1795
http://redbubble.com 6 1938
http://www.redbubble.com/ 6 1938
http://blog.com 6 2318
http://skyrock.com 6 2383
http://ghanaweb.com 6 2739
http://ucoz.com 6 2800
http://care2.com 6 3893
http://dzone.com 6 5645
http://webnode.com 6 6205
http://eklablog.com 6 7890
http://yudu.com 6 8233
http://wayn.com 6 8850
http://travelplus.wayn.com/ 6 8850
http://socialmediatoday.com 6 9321
http://socialmediatoday.com/ 6 9321
http://unblog.fr 6 9755
http://dreamwidth.org 6 9826
http://wetpaint.com 6 10758
http://albawaba.com 6 14217
http://rebelmouse.com 6 16059
http://blogtalkradio.com 6 17450
http://squidoo.com 6 18963
http://moonfruit.com 6 20261
http://buzznet.com 6 21739
http://dailystrength.org 6 22949
http://www.dailystrength.org/ 6 22949
http://soundclick.com 6 24555
http://bitcomet.com 6 29784
http://freehostia.com 6 31718
http://blackplanet.com 6 35109
http://sitew.com 6 37094
http://www.sitew.com/ 6 37094
http://travelpod.com 6 37172
http://netlog.com 6 41836
http://kidblog.org 6 46836
http://snackwebsites.com 6 51997
http://travelblog.org 6 54371
http://blog.co.uk 6 61772
http://www.blog.co.uk/ 6 61772
http://doodlekit.com 6 65012
http://areavoices.com 6 72122
http://allvoices.com 6 76758
http://twoday.net 6 91692
http://quizilla.teennick.com 6 108496
http://migente.com 6 113917
http://www.migente.com/ 6 113917
http://friendster.com 6 118986
http://hotklix.com 6 160637
http://blogsome.com 6 179246
http://datahub.io 6 191673
http://bravejournal.com 6 196912
http://en.over-blog.com 6 284638
http://blog.fr 6 298124
http://multiply.com 6 457330
http://zootoo.com 6 461654
http://sphinn.com 6 579476
http://blog.yahoo.com 5 5
http://blog.interia.pl 5 661
http://myanimelist.net 5 1480
http://myanimelist.net/ 5 1480
http://mouthshut.com 5 4166
http://centerblog.net 5 5363
http://yuku.com 5 5606
http://gaiaonline.com 5 6539
http://soup.io 5 7289
http://www.soup.io/ 5 7289
http://bravesites.com 5 10181
http://forumotion.com 5 11008
http://ge.tt 5 11318
http://fotki.com 5 13054
http://jigsy.com 5 13058
http://foroactivo.com 5 13740
http://23hq.com 5 13828
http://kiwibox.com 5 13881
http://pen.io 5 14442
http://pen.io/ 5 14442
http://beep.com 5 16921
http://page.tl 5 17588
http://ipernity.com 5 20777
http://www.smore.com/ 5 20935
http://own-free-website.com 5 25748
http://www.own-free-website.com/ 5 25748
http://sosblogs.com 5 27526
http://www.sosblogs.com/ 5 27526
http://spruz.com 5 31504
http://www.spruz.com/ 5 31504
http://jambase.com 5 36847
http://www.jambase.com/ 5 36847
http://tribe.net 5 39054
http://pusha.se 5 41220
http://onsugar.com 5 42433
http://www.kickofflabs.com/ 5 43727
http://travellerspoint.com 5 46899
http://snappages.com 5 49285
http://snappages.com/ 5 49285
http://cabanova.com 5 52666
http://www.cabanova.com/ 5 52666
http://doomby.com 5 52669
http://www.doomby.com/ 5 52669
http://thoughts.com 5 53825
http://webgarden.com 5 55083
http://www.webgarden.com/ 5 55083
http://hazblog.com 5 81172
http://blog.hr 5 83366
http://filesanywhere.com 5 105258
http://43things.com 5 108321
http://xfire.com 5 127517
http://devhub.com 5 130215
http://www.devhub.com/ 5 130215
http://blog.com.es 5 142179
http://mytripjournal.com 5 142674
http://webspawner.com 5 156942
http://www.webspawner.com/ 5 156942
http://blogbaker.com 5 157339
http://www.blogbaker.com/ 5 157339
http://blogdrive.com 5 162766
http://20minutes-blogs.fr 5 184290
http://diaryland.com 5 344201
http://www.asianave.com/ 5 382588
http://wordpressy.pl 5 601449
http://journalspace.com 5 608680
http://sosblog.com 5 675485
http://pdfcast.org 5 966347
http://opendiary.com 5 1013641
http://crowdvine.com 5 1359289
http://shoutpost.com 4 0
http://mywapblog.com 4 5689
http://experienceproject.com 4 8704
http://bcz.com 4 23679
http://docdroid.net 4 24460
http://exteen.com 4 24611
http://wallinside.com 4 29243
http://postbit.com 4 32266
http://freewebsite-service.com 4 47929
http://kazeo.com 4 55944
http://hatena.com 4 62117
http://manifo.com 4 62584
http://freepdfhosting.com 4 84554
http://getjealous.com 4 110554
http://slmame.com 4 126805
http://maruta.be 4 129421
http://soulcast.com 4 132851
http://flixya.com 4 148577
http://tblog.com 4 155819
http://blog.wox.cc 4 174591
http://postagon.com 4 184223
http://zoomgroups.com 4 186625
http://nexopia.com 4 192363
http://sailblogs.com 4 224227
http://beeplog.de 4 238797
http://fotopages.com 4 245128
http://www.ourstory.com/ 4 261213
http://vefblog.net 4 273720
http://workitmom.com 4 280339
http://workitmom.com/ 4 280339
http://yousaytoo.com 4 306645
http://jux.com 4 461107
http://jux.com/ 4 461107
http://a-thera.com 4 469181
http://ohlog.com 4 472055
http://blogspace.fr 4 494122
http://geckogo.com 4 573490
http://www.geckogo.com/ 4 573490
http://iloveblog.com 4 611007
http://bigcontact.com 4 718956
http://www.ziki.com/ 4 747316
http://20six.co.uk 4 946786
http://trusted.md 4 990256
http://blogskinny.com 4 1806288
http://unityfirst.com 4 1935572
http://de.la 4 3172228
http://purevolume.com 3 13038
http://www.purevolume.com/ 3 13038
http://selfgrowth.com 3 14081
http://inube.com 3 20539
http://insanejournal.com 3 33487
http://friendsite.com 3 42909
http://blogigo.com 3 101557
http://joe.pl 3 137983
http://mymfb.com 3 176911
http://iblog.at 3 240071
http://space.travel 3 252300
http://bloghi.com 3 335143
http://vip-blog.com 3 351926
http://iseekblog.com 3 496484
http://busythumbs.com 3 501549
http://yourtrainings.com 3 551292
http://sweetcircles.com 3 756179
http://bloggers.nl 3 844133
http://bloggerteam.com 3 1146384
http://awebcafe.com 3 3690384
http://blurpalicious.com 2 49591
http://worldvillage.com 2 718151
http://greasy.com 2 1605982
http://fizzlive.com 2 1726156
http://uwcblog.com 1 1340662

 

Read more blogs or stay tuned with The Flash Updates