[pmwiki-users] Redirecting pages to external URLs
5ko at 5ko.fr
Thu Dec 31 10:30:36 CST 2009
On Thursday 31 December 2009 15:42:51, Bernard Bel wrote :
> This feature is the page redirection to an external URL. On my sites we
> have taken the habit of writing significant acronyms between square
> brackets so that they automatically point at a specific page. For
> instance, [[CNAM]] links to the "CNAM" page and this page has an external
> redirection to
> This has the immense advantage that (1) we do not need to repeat external
> URLs and (2) any change in an external URL can be updated by editing the
> unique page that contains it.
You can add a custom "extredirect" markup like this :
(:extredirect http://external.site.com/dir/file.html#anchor :)
Adding the following code to local/config.php will enable it :
Markup('extredirect', '<include', '/\\(:extredirect\\s+(\\S.*?):\\)/ei',
$SaveAttrPatterns['/\\(:extredirect\\s.*?:\\)/i'] = ' ';
For security reasons, this is NOT recommended on open public wikis - any wiki
page could be redirected to external (ad/porn/phishing) websites.
Also note that when you save the page, you'll be immediately sent out of the
wiki. Re-editing the page requires to type the ?action=edit url in your
browser. These may be confusing and hard for less experienced users.
For these reasons, I wouldn't recommend enabling external redirects, if you
can just place a link on the redirect page. Visitors will have an additional
step to go out - a single link is not hard to click. You can always edit the
page to update a broken link. It is possible to edit it from within the wiki.
You can also have multiple links for the visitor, like :
Liens externes :
* [[http://www.ameli.fr/ | Site institutionnel]]
* [[http://fr.wikipedia.org/wiki/CNAM | Page de CNAM sur Wikipédia]]
Pages de ce site possedant un lien vers cette page :
This may even fit nicely in the Category feature, where, in pages, you just
use a link [[!CPAM]] instead of [[CPAM]].
> To make things clear I would not migrate to a wiki that does not permit
> external redirection. (MoinMoinWiki, which I almost opted for, does it
> A quick search on the web led me to these suggestions:
> However none of them does a single external redirection from a single page.
They may be easier to bulk-create, to control and to manage in the long run.
They're definitely safer.
> In addition, I don't understand how a call of a page might open
> "local/Site.Redirect.php". I guess that some extra PHP code is required in
If the file exists, local/Site.Redirect.php is included automatically in
pmwiki.php, when a visitor goes to the page [[Site/Redirect]].
More information about the pmwiki-users