Hiya,
A really quick post this one and a really simple plugin but it may come in handy for someone somewhere.
Plugin Usage :
This plugin is exceptionally simple to use. Place the following tag on any template as shown below :
Using full URL - useful for external sites.
{exp:redirect_to location="http://www.yahoo.com"}or using paths instead - useful for internal links.
{exp:redirect_to location="news/detail/news_story"}By default PHP redirection will be performed. If PHP redirection does not work,
use javascript redirection by adding method=“script” parameter.{exp:redirect_to location="news/detail/news_story" method="script"}If it is impossible by usual means to check if condition for redirection was met or not you can
check it by wrapping the code expressing condition by {exp:redirect_to}{/exp:redirect_to} tags.
Redirection will be performed if the code wrapped by {exp:redirect_to}{/exp:redirect_to} tags will produce
no output.{exp:redirect_to location="my_template_group/my_template" method="script"}
{exp:query sql="SELECT title FROM exp_weblog_titles WHERE weblog_id = '5' AND url_title ='My title'"}
{title}
{/exp:query}
{/exp:redirect_to}
If you want that redirection would be performed on condition that certain output were produced, you should
enter expected string as a value of “tagdata” parameter. Then the redirection will be performed if
the string entered as “tagdata” parameter value and output of the code
wrapped by {exp:redirect_to}{/exp:redirect_to} tags are identical. (Tabs, spaces and new line characters
will be stripped.) In example below redirect will occur if {exp:query tag} will produce string “1”.{exp:redirect_to location="my_template_group/my_template" tagdata="1" method="script"}
{exp:query sql="SELECT title FROM exp_weblog_titles WHERE weblog_id = '5' AND url_title ='My title'"}
{total_results}
{/exp:query}
{/exp:redirect_to}
Basically if you place this into a template then you will be re-directed to the URL specified in the location parameter.
Hope it helps.
Best wishes,
Mark
