Thursday, 29 April 2010 19:58
Written by Chris Conrad
For security and other reasons you should make it less obvious that your site is running Joomla. The META tag "generator" value is easy to modify or remove with one line of code, placed in one, or several files. Depending on where you put this code, you may have to re-enter it after a JOOMLA core update / upgrade.
Start your favorite editor and open 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 . Some page will have many of these blocks of code. Place the following code snippet (2 lines) in the first block, just before the closing PHP brace which for you noobs, looks like this "?>" without the quotes.
// Remove the generator meta tag
$this->setGenerator(null);
What you 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 nothing (that's what null means). After you do this and upload your file, refresh your web page and view the source of the output. Search or look down from the top of the file to find the new meta generator tag, which at this point is blank. Don't be alarmed, it's okay for it to have nothing there as it will not affect your SEO.
<meta name="generator" content="" />
Some people may not like it so obviously there with an empty value, but it leaves no clues as to what CMS is running the web site and blank is probably the safest value. You could set it to anything you prefer but you really don't want to have improper code structure or usage of the website meta tag. I usually keep it simple and clean without any strange characters (important for you noobs). To change it use the following:
// Change the generator meta tag
$this->setGenerator('My Text here');
Almost done...
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 (this is in files from 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 files in the Template section of the CodersResource.com, JOOMLA section. You're done! And it's JOOMLA upgrade proof as long as you don't change your template or remove the custom generator META tag code snippets you've added.
This makes JOOMLA! 1.6 a great choice to power your site, anonymously so your boss doesn't feel cheap because he's using an Open Source, non M$, platform. You can also apply the joomlawork sef patch wich will remove the JOOMLA! generator tag as well vs. modifying these pages manually