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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.