Page Redirection |
|
|
MetaMods have a lot of data at their disposal. The rules based on this data are not restricted to just selecting modules – you can make Joomla perform other actions as well. In this recipe we demonstrate how to make Joomla redirect to a different page if the rules succeed. This might be useful, for example, for helping to protect a page from viewing unless particular conditions are met, in a more flexible way than you can normally do with Joomla e.g. limit page view to a particular user, or GeoIP country, and kick any other users or countries onto an alternative, more apropriate page... // user name example $app = &JFactory::getApplication(); if ($user->name != "John Doe") $app->redirect("http://www.example.com/alternative_page.html"); // GeoIP example. // This page is only for New Zealand viewers, kick Australians onto specific page and // all other countries onto an international pricing page. $app = &JFactory::getApplication(); if ( $fromCountryId == "AU" ) $app->redirect("http://www.example.com/oz_pricing"); else if ( $fromCountryId != "NZ" ) $app->redirect("http://www.example.com/international_pricing"); |


