Redirection to another confluence base url

Hi All,

I have migrated the one server (http://server_old) confluence to the other server (http://server_new), now i am required to do redirection to the new server when people type in the old server confluence address with any page

example case: http://server_old/any_space/any_page => http://server_new/any_space/any_page)

May i know is there anyway to do this?

Thanks in advanced.

3 answers

0 vote

Not in the application, but there's options.

If you're running it behind something like Apache, then that can easily do rewrites or redirects.

You could do it with network config too, simply mapping DNS so that the old server name resolves to the new one.

The Tomcat running Confluence might be capable of redirecting too, although I'm not sure (and I don't know that you're actually on Tomcat either - look for the docs on whatever application server you are running)

As a last option, write a short web-application that replaces Confluence and redirects if users land on it.

I am running on Tomcat, can teach how to do the redirection using Tomcat? any useful link?

Thanks Nic.

I'm out of my depth I'm afraid - I've nearly always used the DNS method. I've done a couple of Apache tricks and seen a Tomcat app written to redirect certain urls once.

I am running on Tomcat, can teach how to do the redirection using Tomcat? any useful link?

Thanks Nic.

Stumbled across this in a Google search...not sure if it's been answered already elsewhere, but I figured I'd offer what I used to fix it (mostly).

Confluence (at least in v5.3.1) comes with a jar called URLRewrite, which the Confluence server uses for its own purpose. Using that plugin, some DNS wizardry, and the instructions here: http://tuckey.org/urlrewrite/it's possible to set up a redirect so that when someone requests server_old, they hit your new server's Tomcat server though the DNS entry, their URL is rewritten, and the url that shows up is server_new.

The word "mostly" is because while this works well for people who visit the root of the Confluence page, I'm still working out the scenario where the user had a full link (short or long) as the links are being redirected to the home page right now. Since I'm mostly Windows/IIS, this Tomcat stuff isn't so natural, so perhaps there's a way to adjust Tomcat's redirect rules to that end. I'm still hacking away at it, but if I find out what the fix is on that, I'll reply appropriately.

To follow-up, here's what we ended up doing that worked.

1) In the %install_dir%\confluence\Web-Inf\web.xml file - put the following as the first filter in the list of filters

<filter>
<filter-name>UrlRewriteFilter</filter-name>
<filter-class>org.tuckey.web.filters.urlrewrite.UrlRewriteFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>UrlRewriteFilter</filter-name>
<url-pattern>/*</url-pattern>
<dispatcher>REQUEST</dispatcher>
<dispatcher>FORWARD</dispatcher>
</filter-mapping>

2) In the %install_dir%\confluence\Web-Inf\urlrewrite.xml file, add the following at the bottom of the doc, right before the </urlrewrite> tag:

<rule>
<condition name="host" operator="notequal">^server_new</condition>
<condition name="host" operator="notequal">^localhost</condition>
<condition type="port" operator="equal">port Tomcat server is running on</condition>
<from>^/(.*)</from>
<to type="permanent-redirect" last="true">http://server_new/$1</to>
</rule>

If you are running Confluence over SSL, then you will need two of the above rules, one for each port Tomcat has open (defaults of 8090 and 8443). The $1 is extremely important; without it, tiny links with server_old as the server will redirect to the root of the Confluence instance instead of the desired page.

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Posted 3 hours ago in Off-topic

Miscellaneous Monday - CreatatronV3

You may remember, not so long ago, that together we invented the most evil of machines: The Destructo5000!  The effects of missing Durian rippled over nations. Complete chaos as goat chee...

37 views 2 2
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you