This (very simple) plugin had been done from my article on the txp-fr community website and a request by Lawrence. It support multiple website inbound links (see list attribute below) and makes distinction upon domains and sub domain names for referrers.
For maketing reasons, you could wish to redirect your visitors who come from others websites you made when they click on your personal website Url (inbound links). The only thing you need before using this plugin, is to have your personal website Url on external websites (i.e. http://my-domain.com link shown on the http://textpattern.com website). Multiple inbound websites possible see list attribute below.
Installation & usage
Install this plugin as always, then activate it.
Place the only one tag available in the very top of your “default” page as this:
<txp:pat_referrers list="" separator="," redirect="" external="" status="" default=""/>
Six attributes are available to make your work:
list: [required] a comma separated list of website Urls (Default: empty).
separator: [optional] separator sign used into the list above (Default: “,” comma)
redirect: [required] section name of your redirection for referrers listed in the “list” attribute above (Default: empty).
status: boolean [optional], if set to 1 a “301 Moved Permanently” status is send. Useful to tell search engine bots that the TXP section must never more to be indexed. Note: in this case,
redirectattribute must to be set. Default: 0 (no status send).
external: Url [optional], a full external website Url to redirect your visitors (i.e.
external="http://google.com"as external website address). Default: empty.
default: [optional] your section name for all other visitors they don’t came from websites listed in the “list” above. (Default “” empty = your main page)
<txp:pat_referrers list="forum.textpattern.com,apple.com" redirect="my-portfolio" default="" />
The example above redirect to your my-portfolio page all vistors who came from the http://forum.textpattern.com or http://apple.com websites where your website Url is shown. While all other visitors will have access to your home page.
Many thanks for all TXP plugin creators from whom I learn lot. Special thanks to Jukka Svahn who reviewed this code.
Thanks to Ralitza” for the
external new feature idea and Colak for the redirect attribute improvement.
9 march 2012: v0.1 initial commit.
9 march 2012: v0.2 public version with code reviewed.
02 april 2012: v0.3 accept external websites redirection (Thanks Ralitza ;).
27 april 2012: v0.4 Status attribute added. Redirect attribute accepts empty value for non redirection rendering (Thanks Colak). Help text updated.
28 april 2012: v0.5 Makes distinction upon domain and sub domain names.