Different title, keyword and description in every page's Print

  • 31

How can I add a different title, keyword and description in every page's <head> of my simple php website dynamically?

I have included file header.php in all of my pages, how can i know in what page the user in?

For example, I have php files register.php, and login.php, and I need different titles, keywords and descriptions.

I do not want use the $_GET method.



Set variables at the top of each page that will be read by header.php. Then insert the values of the variables in the right places in header.php. Here is an example:


    $title ="Registration";
    $keywords ="Register, login";
    $description ="Page for user registration";



        <meta name="keywords" content="<?php echo $keywords;?>" />
        <meta name="description" content="<?php echo $description;?>" />
        <title><?php echo $title;?></title></head><body>

Was this answer helpful?

« Back

Powered by WHMCompleteSolution