This documentation is deprecated. Adaptavist's documentation has moved to a new location where it is maintained and updated. Please visit Adaptavist's new Documentation area.
redirect macro
The {redirect} macro will automatically redirect the browser to an alternate web page either within your own site or on an external site...
There are several circumstances under which you may require this macro:
You have moved content to another space or site but people are still visiting the old location - the macro will automatically take them to the new location
You want to provide a static URL to some information that changes location occasionally - hand out the fixed URL and use the macro to automatically redirect the user to the current destination URL
Parameters:
The {redirect} macro has the following parameters:
{redirect:location|delay=time}
Parameter
Required
Default
Notes
default
The default "location" parameter specifies the target destination - either a page title from your own site or an external URL.
delay
0
The amount of time to wait, in seconds, before automatically redirecting the user to the target page.
location
The external URL to redirect to.
Notes:
When using this macro, please bear the following points in mind:
This macro does not keep track of whether the target page has had its name or URL changed and as such it's possible for the link to break
To edit a page which redirects instantly, manually add '?redirect=false' to the URL of the page that contains the redirect.
This macro uses JavaScript to redirect, so browsers with JavaScript turned off will require the user to manually click a link to take them to the target location.
Examples:
Basic Use - Redirecting to a local page
To redirect to a local page in the same space, simply use the page title as the default parameter:
{redirect:Home}
When placed on to a page, any user visiting that page would be immediately taken to the home page of the same Space.
Redirecting to a page in another space
You can redirect to a page in a different space as follows:
{redirect:SpaceKey:Home}
This would immediately redirect to the page called "Home" in the space with key "SpaceKey".
This is quite useful if you want to immediately redirect anyone who accesses The Dashboard via the Breadcrumb Trail to a specific page within a specific space.
If you merely want to set a different home page for your Builder account, see our tutorial on setting a different Site Homepage. This would still allow people to access The Dashboard but when they first enter your site they would be taken to the home page of a specific space.
External locations
To redirect to an external location, simply specify it's URL. For example:
By default, the redirect will occur as soon as someone goes to the page that contains the macro. However, you can pause for a while (for example, to display a message explaining that the user should update their bookmarks, etc) by adding a delay:
Your bookmarks are out of date!
{redirect:http://adaptavist.com|delay=5}
This would display the following message for roughly 5 seconds then automatically redirect the user to the link specified:
Your bookmarks are out of date!
Redirection Notice This page should redirect to http://adaptavist.com in about X seconds.
As you can see, the redirect macro will also add a note macro to the page to ensure that if the browser doesn't have JavaScript enabled the user can click the link to the target page.
Changing an instant redirect
If your page is set to immediately redirect, you're obviously not going to have chance to edit the page should you wish to alter or remove the redirect!
To do this, you need to alter the URL to the page that contains the macro...
Start by getting the URL to the page - for example, the URL to the page you are looking at now is:
Tip:
If there is a page that links to the page containing the redirect, you can right-click the link and choose Copy Shortcut or Copy Link Location (depending on which web browser you use).
To temporarily disable the redirect, add "?redirect=false" to the end of the URL, so in our example the URL would become:
This URL would then display the page but disable the redirect, allowing you to edit the page to make any changes or even remove the redirect.
Hints and Tips:
When you are first adding the macro to a page, set a delay of something like 20 seconds - this way, if there is a problem with the redirect, it's much easier to redisplay the page and edit it to fix the URL, etc. Once you are happy that the redirect is working, you can easily reduce or remove the delay.
Frequently Asked Questions:
Q
I merely want to redirect to a page with a similar name, is there an easier way?
I am a myspace.com user, I want to redirect a page to another myspace page but t...
I am a myspace.com user, I want to redirect a page to another myspace page but the only code I have found uses "meta" and myspace doesnt allow that type of code. Is there an alternate way for me to redirect one myspace page (http:myspace/1) to another (http:myspace/2)?
Sorry, this documentation isn't anything to do with myspace.com – you'd ha...
Sorry, this documentation isn't anything to do with myspace.com – you'd have to ask the people who are in charge of that service for details on how to do redirects.
How to redirect on pages with parameters?
E.g. On my special NEWS space, I want...
How to redirect on pages with parameters?
E.g. On my special NEWS space, I want to redirect space homepage to that space's news page (http:\//myurl/confluence/pages/viewrecentblogposts.action?key=NEWS).
However I get only redirect: Please provide a page or URL to redirect to. error and putting %3F instead of "?" doesn't help, too.
I was going to say use the {blog-posts} macro, but then realised that doesn't di...
I was going to say use the {blog-posts} macro, but then realised that doesn't display the calendar at the site. Can you add a feature request to JIRA (see issue tracking tab at the top of this page) and we'll see if we can find out what's causing this to fail.
You can probably do something similar with Customware's Visibility plugin (the show-to macro and hide-from macro) although those particular macros are really buggy in the latest release of the Visibility plugin, hence us adding similar functionality to our Theme Builder plugin.
I have some users who want me to make a simple "E-mail Archives" link that shows...
I have some users who want me to make a simple "E-mail Archives" link that shows up in our pagetree menu. I created the page, and used this macro to forward to the correct location:
Unfortunately we have two third-level domains for our content. If a user logs in to http://two.confluenceinstall.com and clicks on this link, s/he will be prompted for a login.
Is there any way to do relative urls with this macro?
Not automatically - it depends on your browser config as to how it treats extern...
Not automatically - it depends on your browser config as to how it treats external URLs, eg. I've set my Firefox browser to open links to external sites in a new tab.
You can force a link to open in a new window using either the link-to macro (which I rarely use) or the menulink macro using the "target" parameter.
the ampersand is getting converted to & which doesn't seem to be working in FireFox for the intended purpose, although it does seem to work in IE. I've tried various methods of escaping the ampersand (%26) without success, any ideas?
I have done an instant redirect to another confluence page and using "?redirect=...
I have done an instant redirect to another confluence page and using "?redirect=false" will not work. Is there a way I can still edit my redirect page?
I think if I have the page ID, I can put the "edit" address directly in the address bar, but not sure how I can find out the page ID.
I figured out how to find the page ID of parent page. All I needed to do is put...
I figured out how to find the page ID of parent page. All I needed to do is put the following code in the child of the redirect page, then put the "edit" address in the address bar. All is good now. Thanks.
Setup:
I would like to create a template including redirect to parent page. On p...
Setup:
I would like to create a template including redirect to parent page. On parent page I include "link-to:page edit" within a list that has been collected from child pages using reporting-macro onb child pages to be able to edit a specific page later.
Problem
As I use a template I need the ability to insert the parent page name into the redirect macro on creation or by injecting it.
What to achieve
If someone views a childpage he would be redirected to the parent page immiediately. All content of a child page is displayed on the parent page. On the parent page I have a list, that is visible to certain useres who have permission to edit childpages.
Why so comnplicated
Content on parent page uses Scaffold and content on childpage cant, because links would break inside content if page titles got changed. Solution is to have childes that include all content with links to other pages.
If redirect-macro could have a body as an option I could insert "page-info:title|page=@parent" to fetch the parent page-title
Any Idea how to achieve this or does anyone know another way or workaround.
Setup:
On child pages I include a redirect to a parent page. On parent page I in...
Setup:
On child pages I include a redirect to a parent page. On parent page I include the content of child pages with reporting plugin.
Problem:
Viewing parent page starts to redirect due to redirect-macro included on childpages.
What to achieve:
Redirection takes only place if a childpage is tried to be viewed directly but does not take place if the content of the childpage is viewed via parent page.
Comments (19)
Mar 02, 2006
Anonymous says:
I am a myspace.com user, I want to redirect a page to another myspace page but t...I am a myspace.com user, I want to redirect a page to another myspace page but the only code I have found uses "meta" and myspace doesnt allow that type of code. Is there an alternate way for me to redirect one myspace page (http:myspace/1) to another (http:myspace/2)?
Mar 02, 2006
Guy Fraser says:
Sorry, this documentation isn't anything to do with myspace.com – you'd ha...Sorry, this documentation isn't anything to do with myspace.com – you'd have to ask the people who are in charge of that service for details on how to do redirects.
Mar 09, 2006
Anonymous says:
How to redirect on pages with parameters? E.g. On my special NEWS space, I want...How to redirect on pages with parameters?
E.g. On my special NEWS space, I want to redirect space homepage to that space's news page (http:\//myurl/confluence/pages/viewrecentblogposts.action?key=NEWS).
However I get only redirect: Please provide a page or URL to redirect to. error and putting %3F instead of "?" doesn't help, too.
Mar 09, 2006
Guy Fraser says:
I was going to say use the {blog-posts} macro, but then realised that doesn't di...I was going to say use the {blog-posts} macro, but then realised that doesn't display the calendar at the site. Can you add a feature request to JIRA (see issue tracking tab at the top of this page) and we'll see if we can find out what's causing this to fail.
Jan 19, 2007
Anonymous says:
Link to JIRA project is broken.Link to JIRA project is broken.
Jan 19, 2007
Guy Fraser says:
Thanks for bringing that to our attention - now fixedThanks for bringing that to our attention - now fixed
Apr 04, 2008
Mickaël Rémond says:
Can this macro be used for conditionnal redirect ? What I need is the following...Can this macro be used for conditionnal redirect ?
What I need is the following:
Can this macro do the job ?
Thank you !
–
Mickaël Rémond
http://www.process-one.net/
Jul 21, 2008
Guy Fraser says:
If you've got Theme Builder 3.0.0 or higher installed, use builder-show and buil...If you've got Theme Builder 3.0.0 or higher installed, use builder-show and builder-hide:
{builder-show:group=confluence-users} {redirect ...private space...} {builder-show} {builder-hide:group=confluence-users} {redirect ...public space...} {builder-hide}You can probably do something similar with Customware's Visibility plugin (the show-to macro and hide-from macro) although those particular macros are really buggy in the latest release of the Visibility plugin, hence us adding similar functionality to our Theme Builder plugin.
May 27, 2008
Rusty says:
I have some users who want me to make a simple "E-mail Archives" link that shows...I have some users who want me to make a simple "E-mail Archives" link that shows up in our pagetree menu. I created the page, and used this macro to forward to the correct location:
{redirect:location=http://one.confluenceinstall.com/spaces/viewmailarchive.action?key=GROUP}Unfortunately we have two third-level domains for our content. If a user logs in to http://two.confluenceinstall.com and clicks on this link, s/he will be prompted for a login.
Is there any way to do relative urls with this macro?
May 30, 2008
Arne Oehlsen says:
I have a problem to edit pages that include the redirect macro. My page URL does...I have a problem to edit pages that include the redirect macro.
)
My page URL does not follow the scheme http://www.adaptavist.com/display/USERGUIDE/redirect+macro
but looks something like http://XXX.XXXYYYY.de/confluence/pages/viewpage.action?pageId=12847705
(i guess because the page title is a long german phrase full of special characters
and because of this structure the "?redirect=false" after the URL does not seem to work and i cant access the page in edit mode at all ...
any idea how to deal with this?
thanks in advance,
Arne
Oct 30, 2008
Betsy Walker says:
Is there a way to make the external URL open in a new window?Is there a way to make the external URL open in a new window?
Oct 30, 2008
Guy Fraser says:
Not automatically - it depends on your browser config as to how it treats extern...Not automatically - it depends on your browser config as to how it treats external URLs, eg. I've set my Firefox browser to open links to external sites in a new tab.
You can force a link to open in a new window using either the link-to macro (which I rarely use) or the menulink macro using the "target" parameter.
Jul 13, 2009
Jeff M says:
I seem to be having an issue when attempting to redirect to an external URL that...I seem to be having an issue when attempting to redirect to an external URL that contains multiple parameters, such as: http://www.domain.com?parameter1=test¶meter2=sample
the ampersand is getting converted to & which doesn't seem to be working in FireFox for the intended purpose, although it does seem to work in IE. I've tried various methods of escaping the ampersand (%26) without success, any ideas?
Sep 14, 2009
David Chapman says:
There appears to be a delay in the redirection that I cannot seem to override. ...There appears to be a delay in the redirection that I cannot seem to override. It displays the yellow "redirecting" screen for a few seconds.
Oct 20, 2010
Matus says:
Me too and I don't like thisMe too and I don't like this
Apr 06, 2010
Wayne Parker says:
I have done an instant redirect to another confluence page and using "?redirect=...I have done an instant redirect to another confluence page and using "?redirect=false" will not work. Is there a way I can still edit my redirect page?
I think if I have the page ID, I can put the "edit" address directly in the address bar, but not sure how I can find out the page ID.
Any help is greatly appreciated.
Apr 06, 2010
Wayne Parker says:
I figured out how to find the page ID of parent page. All I needed to do is put...I figured out how to find the page ID of parent page. All I needed to do is put the following code in the child of the redirect page, then put the "edit" address in the address bar. All is good now. Thanks.
{page-info:displaypageID|page=@parent}Jan 02, 2011
Klaus Feldmann says:
Setup: I would like to create a template including redirect to parent page. On p...Setup:
I would like to create a template including redirect to parent page. On parent page I include "link-to:page edit" within a list that has been collected from child pages using reporting-macro onb child pages to be able to edit a specific page later.
Problem
As I use a template I need the ability to insert the parent page name into the redirect macro on creation or by injecting it.
What to achieve
If someone views a childpage he would be redirected to the parent page immiediately. All content of a child page is displayed on the parent page. On the parent page I have a list, that is visible to certain useres who have permission to edit childpages.
Why so comnplicated
Content on parent page uses Scaffold and content on childpage cant, because links would break inside content if page titles got changed. Solution is to have childes that include all content with links to other pages.
If redirect-macro could have a body as an option I could insert "page-info:title|page=@parent" to fetch the parent page-title
Any Idea how to achieve this or does anyone know another way or workaround.
Jan 02, 2011
Klaus Feldmann says:
Setup: On child pages I include a redirect to a parent page. On parent page I in...Setup:
On child pages I include a redirect to a parent page. On parent page I include the content of child pages with reporting plugin.
Problem:
Viewing parent page starts to redirect due to redirect-macro included on childpages.
What to achieve:
Redirection takes only place if a childpage is tried to be viewed directly but does not take place if the content of the childpage is viewed via parent page.
Any Idea?