Sometimes, it may be required to redirect existing URLs to Confluence without losing access to the existing URLs you gave out to customers. This can be achieved by having a webserver redirect URLs to the app's /go suffix and then creating redirects for the previous pages to the new pages.

A common scenario where this might happen is if you migrate a web page to Confluence. The server will be configured to rewrite the domain and path to the app's base URL in Confluence, e.g. https://confluence.example.com/go.

Example:

Prerequisites:

  • An external HTTP server serving the domain you want to redirect. This guide will give you configurations for Apache and nginx, but others should work too
  • The domain you'd like to redirect pointing to that server
  • Knowledge of and permissions to edit that HTTP server's configuration

Step 1: Create Confluence pages corresponding to your old URLs

For all existing pages in your website that you'd like to preserve, you need to create a Confluence page. Then copy the contents of each page.

Step 2: Create URL mappings in the app

Once you've created all Confluence pages, you need to create the URL mappings in the app. Do this as described on Configure the App via the Main Configuration Page. Make sure each entry's shortened URL corresponds to the path that the page used to have.

Example: If you used to have the pages http://example.com/index.htmlhttp://example.com/product.html and http://example.com/about.html, create entries with the shortened URLs index.html, product.html and about.html.


Step 3: External HTTP server configuration

Depending on the HTTP server you are using, you will have to use different configuration steps. Note that this guide omits the configuration steps necessary to get the HTTP server to serve your domain. Refer to other configuration guides for that.

This document assumes your domain is example.com and your Confluence instance is hosted at confluence.example.com.

For TLS support, create a similar directives, redirecting to https://confluence.example.com/go .

Step 3a: Apache configuration

For this to work, you must have mod_alias enabled and working in your apache configuration. Then edit your apache configuration or add a virtual host file containing the following configuration:

Apache redirection configuration
<VirtualHost *:80>
    ServerName example.com
    RedirectPermanent / http://confluence.example.com/go
</VirtualHost>

Step 3b: nginx configuration

Edit your nginx.conf file to contain the following lines:

nginx redirection configuration
server {
  server_name .example.com;
  return 301 http://confluence.example.com/go$request_uri;
}

Done!

Make sure you test your setup to see if everything works as expected.