Guides
Tutorials
Pop Tags

Redirection

You can use <pop:redirect> to create a redirect to another page. Here’s a way to let a section index always redirect to the first entry in the section:

<pop:redirect to="<pop:entries limit='1'><pop:permalink/></pop:entries>"/>

The <pop:redirect> tag takes an optional permanent attribute. By default permanent is false and the redirect will use the 302 status code. If permanent is set to true the redirect will be a 301.

Another use for <pop:redirect> is to require authentication for a specific page. You can do this by combining it with <pop:user/> which gives access to the current user if there is one. The following snippet will always redirect to the admin login unless a user is already logged in:

<pop:user>Logged in as <pop:name/></pop:user>
<pop:no_user><pop:redirect to="/admin"/></pop:no_user>

If you need to do a lot of redirects, checkout the Redirects Extension .

Continue to RSS Feeds »