i have some problem, anybody know how2fix that ?
hmm... I’m using this plugin, but if my old URLs have paths, e.g. news/article-123, it doesn’t work. I get 404s instead.
Quote from: ganeshXL at Sep 30, 2008, 04:54 AMi have some problem, anybody know how2fix that ?
hmm... I’m using this plugin, but if my old URLs have paths, e.g. news/article-123, it doesn’t work. I get 404s instead.
/*####
#
# Name: NG!Redirect
# Version: 0.0.2
# Author: Stefan Bruggmann - http://www.ng-projects.ch
@modified: Olivier B. Deland
# Date: Apr 10, 2008 13:12 CET
#
# Latest Version: http://modxcms.com/...
# In use on Site: http://www.ng-studio.ch
#
####
#
#
# Usage:
# Enter your old Site-Names and the new static ones or dynamic id's to the following array like..
#
# Example:
# $sites = array(
# 'The-Old-URL-Without-Extension' => 6,
# 'Another-Old-URL' => 'A-New-Hard-Link'
# );
#
####
*/
$sites = array(
'shop/products/thing.html' => 'shop/products/newthing.html',
'index.html' => 1
);
$e = &$modx->Event;
switch ($e->name) {
case "OnPageNotFound":
$requestedURL = $modx->virtualDir.'/'.$modx->documentIdentifier;
if (isset($sites[$requestedURL])) {
if( is_numeric($sites[$requestedURL]) ){
$url = $modx->makeUrl($sites[$requestedURL],'','','full');
}
else{
$url = $sites[$requestedURL];
}
$this->sendRedirect($url, 0, 'REDIRECT_HEADER', 'HTTP/1.1 301 Moved Permanently');
exit;
}
break;
default :
return; // stop here
}