Page 1 of 1

auto 301 redirect

Posted: Sat Feb 06, 2010 2:23 pm
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