I was recently looking for a clean solution to prevent the display of module positions on gazzetta.gr - the 2nd most high traffic Joomla website, after joomla.org.
The first thing that came to mind was the htaccess trick I had spotted on the Joomla forums here: http://forum.joomla.org/viewtopic.php?p=1887090#p1887090
Thing is, this rule does not work if you have SEF on and you’re in some inside page.
So I just wrote a simple solution which is PHP based and you can include right at the top of your Joomla template for ease of maintenance (template designers can use this too as an XML option ;) )…
Make sure the following code goes at the very top of your template's index.php file, but within <?php and ?> tags:
// Properly prevent ?tp=1 module position exposure on Joomla sites using PHP only$currentURL = explode('?',substr(JURI::base(),0,-1).$_SERVER['REQUEST_URI']);if($_GET['tp']) header('Location: '.$currentURL[0]);
UPDATE: There seems to be a Joomla API solution for that. Thanks to Cory Webb for letting me know. Both solution follow...
JRequest::setVar('tp',0);