Creating a WordPress redirection page

This is the simplest way to add a page redirection feature to your WordPress theme.

First, create a new theme file called redirect.php with the following contents:

<?php
/*
Template Name: Redirect
*/
the_post();
header('Location: ' . get_the_content());
die();

To create a new redirection page:

  1. New page, change the template to ‘Redirect’
  2. Switch to HTML editing mode and put the url in the content area.

December 3, 2012 at 4:17 PM in WordPress

VanDragt.com is a collection and semi organised thought process on web, development and technology news by Sander van Dragt.