and like us on FB

If you have a website under construction, or you have a temporary page placeholder in place, it’s likely that you’ll want to deliver a temporary message until your site is ready. While there’s a plethora of plugins that will achieve what I’ve just described, there were none that would do what I wanted them to do. More to the point, there weren’t any simple plugins that met the needs of my clients. A temporary page is an opportunity to convert upon the transient visitation, or deliver an engaging message that’ll have people checking back in.

As a general rule for any placeholder landing page, you will want to – at the very least – consider rendering the following:

  • Who? Business details. What do you do?
  • Why? Why is your website offline?
  • How? Contact details. Phone number, contact form, email etc.
  • When? When will you be online? Countdown timer, perhaps.
  • Social? Facebook, Twitter, LinkedIn, and other active links.

While we’ll provide details on high-converting landing pages in the future, the focus of this article is merely focused on providing an efficient redirect.

Note: The semi-permanent landing page is different to the maintenance page displayed when upgrading WP or plugins. Snippet here.

Simple Site Redirects

In all the functions below you’ll need to alter the redirect URL (to your landing page) and header code. Both are discussed below.

Copy and paste the WordPress function into your theme's functions.php file or, if you sensibly have one installed, your custom functions plugin.

In the above example we’ll redirect anybody other than a logged in user, or anybody accessing the wp-login.php page. If you chose to include roles other than administrator, the function is modified by way of an array of permitted roles.

Copy and paste the WordPress function into your theme's functions.php file or, if you sensibly have one installed, your custom functions plugin.

If you’re anything like us an enjoy an arsenal of web properties, of you have a domain name library, you might have a single page (upon which you’ll redirect all others) to process and display an appropriate message.

This first function is used on the source website.

Destination Page Code

If using the last function, a destination page should be created to handle all the redirects (with the [underconstruction] shortcode as detailed below). Included in the function is an array of domains that are handled by the redirect… with each array containing a key/value pair of the information you might want associated with the source page. Our value array, for example, is quite extensive and includes details such as whether tha domain is for sale.

The code below requires the beliefmedia_get_domain() function from this page.

Copy and paste the WordPress function into your theme's functions.php file or, if you sensibly have one installed, your custom functions plugin.

The result of our simple example is demonstrated by following khoury.net.au (a WP sandpit I use for development), or aviationtheory.com (an old site I used for an aviation learning management tool).

An unused website or domain is a unique opportunity to convert your transient visitation. I see websites that have a poorly-made “under construction” image or generic “coming soon” text all the time – this is unacceptable if you’re in business. The most obvious solution from a business point of view is to build a static HTML page with business and contact information. Another solution that might be considered (as an alternative to a static HTML page) is a redirect to an active Facebook page.

PHP Code

Used outside of WordPress, the following function may be used.

The function must be called before any content is rendered to your page.

HTTP Header Codes

There’s a number of header codes that could be used for the redirect. We’ve reproduced the most common header codes below (the 302 and 503 header code are most commonly used).

200

Standard response for successful HTTP requests.

301

This and all future requests should be directed to the given URI.

302

Found. This is an example of industry practice contradicting the standard. The HTTP/1.0 specification (RFC 1945) required the client to perform a temporary redirect (the original describing phrase was “Moved Temporarily”).

503

The server is currently unavailable (because it is overloaded or down for maintenance). Generally, this is a temporary state. This code generally stops search engines from indexing the site.

Considerations

Shortt URL for this post: http://shor.tt/Cnw