Are you in the loop? Keep up with the latest by making sure you're subscribed to Community Announcements. Just click Watch and select Articles.

×
Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

How to apply redirection on all pages on a space?

Rahul Aich [Nagra]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
Jul 20, 2016

Hi All

Ihave recently migrated a confluence space from Server A to B.

I want to be able to get users to automatically get redirected from all pages on the migrated space on Server A to Server B.

I am aware of the redirection plugin but you have to apply it on each and every page manually.

Are there any easier options? Plugins? workarounds?

Rahul

2 answers

1 accepted

1 vote
Answer accepted
Branno
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
Jul 21, 2016 • edited Jun 12, 2019

Hey Rahul,

I'm not sure of a plugin that would easily allow this, but it is something you could accomplish using JavaScript. The following will redirect any users accessing a page on the specified space on Server A to the same page on Server B. You will want to paste the following into the 'At the end of the HEAD' section of the Custom HTML section of the Confluence Administration screen. 

<script type="text/javascript">
	function Redirect(newUrl, path) {
		window.location = newUrl + path;
	}
	space = "TEST";
	if (space == AJS.params.spaceKey) {
		var newUrl = "http://new.confluence.com"
		var path = window.location.pathname;
		Redirect(newUrl, path);
	}
</script>

If you would prefer to warn users, you could use an Alert and set a timeout like below:

<script type="text/javascript">
	function Redirect(newUrl, path) {
		window.location = newUrl + path;
	}
	space = "TEST";
	if (space == AJS.params.spaceKey) {
		var newUrl = "http://new.confluence.com"
		var path = window.location.pathname;
		alert("You will be redirected to the new page location in 3 seconds.");
		setTimeout('Redirect(newUrl, path)', 3000);
	}
</script>

To use this, simply edit 'space' to the space key of the space you want this to run in. Also, set the newUrl variable to the hostname of the new Confluence server.

Stephen

This is awesome. I couldn't get the variation with the Alert to work, but version 1 solved a huge issue I had. Thank you!

Since server has had an end of life many of you have moved to cloud. It doesn't allow you to use JavaScript like in server. You might not have a choice but to use an app.

In cloud you can't technically do a redirection. Reach out if you want to know more. This is the app we built for cloud Redirection by Easy Apps.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events