URL Redirection

[Note]Note

This feature is only available in the Professional release

Sometimes you need to create short, memorable URLs to some of your site's pages. Our friend Brian Teeman calls them PEF (Pub Ear Friendly). Arguably, telling someone to visit http://www.example.com/downloads is much easier to remember than a 100+ character long URL.

Some other times you would like to use a short URL to an external site but do not wish to use one of the free services, like bit.ly, ow.ly, t.co or tinyurl.com for privacy reasons. Admin Tools to the rescue! The custom URL redirection feature allows you to do all of the above with a ridiculously simple interface.

The URL Redirection management page

The main administration page shows you a list of the custom URL redirections defined on your sites. Each entry consists of the following information:

  • The left hand checkbox. The toolbar operations will apply only to the checked items.

  • Existing URL. The URL where your visitors will be taken to. It's called "Existing" because it exists even when the URL Redirection feature is not enabled. It is existing content and you're about to create a new URL which will take your visitors to it. Clicking on it will open it in a new window so that you can preview the results.

  • New URL. The relative path on your site which triggers the redirection. It's called "New" because it doesn't exist when the URL Redirection feature is disabled. With the redirections you essentially create a new URL for existing content. For example, if your site is accessible at http://www.example.com/wordpress and this field reads search/google, then all requests to http://www.example.com/wordpress/search/google will be redirected to the Existing URL with a 301 (Permanently Moved) HTTP status code, to keep search engines happy. Clicking on the displayed value will open the Edit/Add page so that you can edit the entry.

  • Keep URL Parameters. During the redirection, what should happen to URL parameters? Read below for further details.

  • Published. When unpublished, the redirection will not take place. Useful to temporarily take down a redirection without deleting it.

When adding a new entry or editing an existing entry, the following page appears:

The URL Redirection editor page

There are three fields to edit:

Existing URL

An existing URL on your site, or a link to an external page.

When using a URL in your own site you do not have to include the URL to your site's root. Use the relative path instead.

The biggest strength of this feature is the ability to enter external links. For instance you can enter http://www.google.com to redirect your visitors to Google's search page. Using this powerful feature allows you to run your private URL shortening service on your own domain!

New URL

The relative path which triggers the redirection.

For example, if your site is accessible as http://www.example.com/wordpress, entering google in this field will cause the URL http://www.example.com/wordpress/google to redirect to the the URL you entered in the Existing URL field above. You can use subdirectories in your path, e.g. search/external/google.

Keep URL Parameters

When set to None any query string parameters in the URL (i.e. anything after the question mark) will be ignored.

When set to Override All any query string parameters in the URL will override any parameters in the Existing URL, or added to it if they didn't exist in the first place.

When set to Add New any query string parameters in the URL which do not exist in the Existing URL will be added to it. Existing query parameters will not be overridden.

Published

When unpublished, the redirection will not take place. Useful to temporarily take down a redirection without deleting it.

[Tip]Tip

If you want to make a simple redirection set Existing URL to the URL you are redirecting to, New URL to the URL you are redirecting from and Keep URL Parameters to None.