auto 301 redirect

For questions and problems with the CMS core. This board is NOT for any 3rd party modules, addons, PHP scripts or anything NOT distributed with the CMS made simple package itself.
Post Reply
kurashiki_ben
Forum Members
Forum Members
Posts: 86
Joined: Sun Jul 05, 2009 2:37 am

auto 301 redirect

Post by kurashiki_ben »

CMS Made Simple 1.6.5 "Poya"

Hi,

I created a redirect for some page aliases that I changed.
For example, if somebody goes to www.mysite.com/page I want them redirected to  www.mysite.com/page1

I saw a solution on the French forum:
http://forum.cmsmadesimple.org/index.ph ... 135.0.html
So I created a UDT called 301_redirect like so:

Code: Select all

$redirections = array('page/' => '/page1/');

foreach($redirections as $key => $value)
{
      if(strpos($_SERVER['REDIRECT_URL'], $key) !== false)
      {
            header('HTTP/1.1 301 Moved Permanently');
            header('Location: '. $value);
      }
}
Then I put the following in the custom 404 handling page in site settings:
{301_redirect}

However, if I go to www.mysite.com/page I just get the 404 message and no redirection happens.

Any ideas??

Best regards

Ben
Post Reply

Return to “CMSMS Core”