Have any page in the Wordpress "Pages" list invisibly redirect to a static page or other url
Posted on Wednesday, February 20th, 2008 at 2:43 pm
The very nature of WordPress demands that you work within it's infrastructure in order to maintain flexibility. Sometimes, though, the structure of your pages demand that you need to operate outside of this constraint.
This template lets you specify a single URL as the page content, then as the page loads, the template automatically redirects the page to this new location.
Once you've uploaded the template-redirect.php file to your themes… sub-directory, i.e. wp-content/themes/theme_name/
1 – Create a new Page in your WordPress control panel
2 – In the Page Content panel, just enter the URL (or local path) you want to redirect to:
3 – Set the Page Template dropdown to "Page Redirect":
Note that in WordPress 2.7 and later, you will need to do a little additional setup work to display the page template dropdown (don't ask me why).
See this link for further details.
Examples of URLS might be:
- category/flowers (a relative link to the permalink for "flowers")
- ../page.html (a page outside of a WordPress subfolder (the WP folder being /blog/) but still in your site)
- http://www.davestewart.co.uk/resources/ (a page on a completely different site)
The "Latest developments…" page in my sidebar automatically redirects to /category/development/ – or in other words, the archive for my "Development" category, as my home page is not the standard "last-post first" format.