GetSimple Support Forum
Simple Redirect Page Template - Printable Version

+- GetSimple Support Forum (http://get-simple.info/forums)
+-- Forum: GetSimple (http://get-simple.info/forums/forumdisplay.php?fid=3)
+--- Forum: Scripts & Components (http://get-simple.info/forums/forumdisplay.php?fid=11)
+--- Thread: Simple Redirect Page Template (/showthread.php?tid=10652)



Simple Redirect Page Template - AnthonyV - 2018-12-22

Copy the following PHP code and paste the contents into a file named redirect.php in your theme folder.

e.g. /theme/Innovation/redirect.php

Then whenever you need redirect a specific page just select "redirect.php" as your page template and set the "Tags & Keywords" in the Page Options of your page to the new URL.

The result will be a Permanently redirect to the new page.

This template will attempt three different redirects.
1) 301 Redirect (which should work)
2) Header Meta Redirect
3) Javascript Redirect



PHP Code:
<?php if(!defined('IN_GS')){ die('you cannot load this page directly.'); }
/****************************************************
*
* @File:         redirect.php
* @Package:        GetSimple
* @Action:        Innovation theme for GetSimple CMS
*
*****************************************************/
# This is a special template page for the purpose of redirecting users to another page.
# Set "Tags & Keywords:" on the Page Pptions to the URL of the new page.
Header("HTTP/1.1 301 Moved Permanently");
Header("Location: " get_page_meta_keywords(false));

?>
<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <title>Permanent Redirect</title>
        <meta http-equiv="refresh" content="0; url=<?php get_page_meta_keywords(); ?>" />
    </head>
    <body onload="window.location.assign('<?php get_page_meta_keywords(); ?>')">
        <h2>Permanent redirect to: <a href="<?php get_page_meta_keywords(); ?>"><?php get_page_meta_keywords(); ?></a></h2>
    </body>
</html>