Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Simple Redirect Page Template
#1
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> 
Reply




Users browsing this thread: 1 Guest(s)