Jump to content

Killing index.php - Need help with a simple PHP SEO script


jakubsnm

Recommended Posts

My software had all default homepage links with .../index.php

 

so i changed them all to mysite.com/

 

I bought a mod for the software which allows you to modify all meta tags for pages in you site, except now that i've killed the ../index.php (even with the robots.txt file) i need a simple script that says.

 

if page = homepage < meta keywords "bla bla"

meta description "bla bla"

>

 

Love whoever can help me with this...  :-*:o

That can be done using a PHP if statement.

 

I would recommend that you simply echo out a variable, containing the keywords for the relevant page. I.e

<?php
  // -----Variables-----
  $requested_path = $_SERVER['REQUEST_URI'];
  $HTML['MetaKeywords'] = 'html, css, php, and, so, on'; // FrontPage Keywords

if ($requested_path !== '/') {
  $HTML['MetaKeywords'] = 'blah, blah';
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">

  <head>
    <title>My first Website</title>
    <meta name="keywords" content="<?php echo $HTML['MetaKeywords']; ?>">
  </head>

  <body>
    <p>My first Website.</p>
  </body>

</html>

 

The above is a nice example, you should however note that the keywords meta tag is obsolete in Google. You may also want to consider getting the keywords from your database, how to do that is beyond this post.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.