Blog Latest Removing the Joomla Generator Tag
 
Removing the Joomla Generator Tag PDF Print E-mail
Digg!

A common request from Joomla web masters is the ability to remove the generator meta tag from the source output of the site.  This is usually for security reasons to make it less obvious that the site is running Joomla.  The generator value is really easy to modify and remove with one line of PHP code.


Fire up your favourite editor and load the index.php file of the default template on your site.  Most templates should have a block of PHP at the top of the file starting with <?php and closing with ?>.  Find this block and just before the closing PHP brace, insert the following lines of code to replace default generator meta tag:

<?php
$this->setGenerator('Open4G Media v3.0b');
?>

What we have done here is told the template (that's what $this is) to set the value of the meta generator tag (that's what setGenerator does) to set 'Open4G Media v3.0b' as value to meta generator tag.  When you do this, refresh your web page and view the source of the output.  Scan down from the top of the file to find the meta generator tag.

  <meta name="generator" content="Open4G Media v3.0b" />

You can see it's obviously still there but the value is 'Open4G Media v3.0b', giving you no clues as to what CMS is running the web site.  You could set it to anything you like if you really wanted to. To remove default generator meta tag insert the following lines of code:

<?php
$this->setGenerator('');
?>

There are several other files that could be loaded by Joomla in the template.  You will also need to do this to the component.php (that supports the Joomla Print View) and if you have a custom Error or Offline page, you will need to add the line of code to error.php and offline.php respectively.  You can find out more about these additional template files in the Template section of the Art of Joomla Developer Reference.

This is just another example of how flexible the Joomla templating engine is and why it's a makes Joomla a great choice to power your web site ... anonymously.

Via: http://www.theartofjoomla.com



Reddit!Del.icio.us!Facebook!Slashdot!Netscape!Technorati!StumbleUpon!Newsvine!Furl!Yahoo!Ma.gnolia!
 

Jomwitter Twitter Badge

Who's Online

We have 26 guests online

Syndication