Redirects

SpinupWP currently supports two different types of redirect:

  1. Domain redirects (e.g. redirecting www.example.com to example.com)
  2. Path redirects (e.g. redirecting example.com/old-post to example.com/new-post)

In this doc, we’ll go over domain redirects. To learn more about creating path redirects, see our Path Redirects doc. Domain redirects are handled automatically by SpinupWP. Below we walk you through redirecting additional domains, setting up additional domain redirects, basic and advanced redirects. We’ll also cover the different types of redirects.

Redirect Additional Domains on Site Setup

During the Domains step of the New Site wizard, it’s possible to redirect additional domains to the primary domain. This can be done by enabling the “Redirect to Primary Domain” toggle.

Redirect to Primary Domain toggle

This will ensure that each additional domain will have a 301 (permanent) redirect to the primary domain. Note that SpinupWP will automatically handle redirecting these additional domains to HTTPS if HTTPS is enabled for the site.

Domain Redirects

If you need to set up additional domain redirects, you can do this by updating the domains for a site. Access the list of currently configured domains from the Domains menu item on the site dashboard.

Domains menu item from site dashboard

Here you can add, edit, or remove any domains attached to your site.

Here you can add, edit, or remove any domains attached to your site.

Basic Domain Redirects

The Basic redirect option should be used when you need a simple 301 redirect from a subdomain or another domain to the primary domain. This option is ideal for any subdomain redirects or to redirect any other top level domains.

For example, you might have turnipjuice.media as your primary domain, but you have also registered turnipjuicemedia.com. You would like to make sure that anyone who visits turnipjuicemedia.com is redirected to turnipjuice.media.

Another common use of a basic redirect is forwarding any www subdomain requests (i.e. www.turnipjuice.media) to the primary domain.

When a Basic redirect is set up, the scheme (eg https://) and path (anything after the domain, including the /) of the requested URL will be passed to the redirected URL.

For example, if a user browses to https://turnipjuicemedia.com/about they will be redirected to https://turnipjuice.media/about.

A Basic redirect is the equivalent of an Advanced redirect with a value of $scheme://domain.com$request_uri.

To set up a Basic redirect on a domain, enter the URL you want the domain to be redirected to in the “Redirect Domain” field.

Redirect URL field

Advanced Domain Redirects

Advanced redirects allow you to create custom redirects beyond a simple 301. You can use Advanced redirects to create a custom redirect using Nginx HTTP variables as well as select from other HTTP redirect types. You might want to redirect all URLs from a domain to the homepage of your primary domain by removing the $request_uri variable for example. Or maybe there’s a specific page you’d like to redirect to by replacing $request_uri with the path to the page.

Redirect Types

The following redirect types (also known as HTTP redirection codes) are available to be set for an advanced redirect. Redirect codes are status codes sent from the server to a browser, when a redirect is implemented.

301 – Moved Permanently The content at this URL has permanently moved to the new URL and all future requests should be directed there. Users and search engines should not come back to the current URL and instead use the new URL going forward.

302 – Found The requested content has temporarily moved to a different URL. Since the redirection might be altered, future requests should continue to use the current URL. Requests with non-GET HTTP methods should be converted to GET for optimal chance of successful redirect.

307 – Temporary Redirect The requested content has temporarily moved to a different URL. Since the redirection may be altered, future requests should continue to use the current URL. Requests with non-GET HTTP methods should explicitly maintain their HTTP method value.

308 – Permanent Redirect This request and all future requests should be repeated using the redirected URL. Requests with non-GET HTTP methods should explicitly maintain their HTTP method value.

When configuring an Advanced Redirect, SpinupWP will default the Redirect URL to $scheme://domain.name$request_uri. $scheme is an Nginx variable that represents the scheme of the URL (typically either http or https) and $request_uri is an Nginx variable that represents any part of the URL that appears after the domain name, including the forward slash /. So given the example https://turnipjuice.media/about:

  • https is the $scheme
  • turnipjuice.media is the domain name
  • /about is the $request_uri

To set up an Advanced redirect on a domain, configure the URL (including the relevant Nginx variables) you want the domain to be redirected to in the “Redirect URL” field and select the “Redirect Type”.

Setting up an Advanced redirect on a domain