I used this plugin to do a 301 and it worked perfectly. However I'm trying to UNDO it now and simply erasing it doesn't do it. I'm not sure what to do.. I was peeking around the plugin file.. any tips on how to undo this would be appreciated PHP Code: /*
Wordpress Simple 301 Redirect Plugin problem..
14
I used this plugin to do a 301 and it worked perfectly. However I'm trying to UNDO it now and simply erasing it doesn't do it. I'm not sure what to do.. I was peeking around the plugin file.. any tips on how to undo this would be appreciated
PHP Code:
/*
save the redirects from the options page to the database
*/
function save_redirects($data)
{
$redirects = array();
for($i = 0; $i < sizeof($data['request']); ++$i) {
$request = trim($data['request'][$i]);
$destination = trim($data['destination'][$i]);
if ($request == '' && $destination == '') { continue; }
else { $redirects[$request] = $destination; }
}
update_option('301_redirects', $redirects);
}
/*
Read the list of redirects and if the current page
is found in the list, send the visitor on her way
*/
function redirect()
{
// this is what the user asked for (strip out home portion, case insensitive)
$userrequest = str_ireplace(get_option('home'),'',$this->getAddress());
$userrequest = rtrim($userrequest,'/');
$redirects = get_option('301_redirects');
if (!empty($redirects)) {
foreach ($redirects as $storedrequest => $destination) {
// compare user request to each 301 stored in the db
if(urldecode($userrequest) == rtrim($storedrequest,'/')) {
header ('HTTP/1.1 301 Moved Permanently');
header ('Location: ' . $destination);
exit();
}
else { unset($redirects); }
}
}
} // end funcion redirect
- marigot
- [ 1 ] Thanks
- Bryan V
- Patrick
- [ 1 ] Thanks
- Bryan V
- [1] reply
- JohnyData
- [1] reply
- JohnyData
- [1] reply
- SteveJohnson
- Bryan V
- Bryan V
- Bryan V
- [1] reply
- Cash Money Hosting
Next Topics on Trending Feed
-
14