function wppa_redirect() { if (!isset($_SERVER["REQUEST_URI"])) { return; } $uri = $_SERVER["REQUEST_URI"]; $wppapos = stripos($uri, '/wppaspec/'); if ($wppapos && get_option('permalink_structure')) { $newuri = wppa_convert_from_pretty($uri); if ($newuri == $uri) { return; } // Although the url is urlencoded it is damaged by wp_redirect when it contains chars like ë, so we do a header() call header('Location: ' . $newuri, true, 302); exit; } }
function wppa_redirect() { // Do we come from a login form ? /* if ( isset( $_POST['redirect_to'] ) ) { wppa_log( 'obs', 'Redirect to: ' . $_POST['redirect_to'] ); wp_redirect( $_POST['redirect_to'] ); } */ if (!isset($_SERVER["REQUEST_URI"])) { return; } $uri = $_SERVER["REQUEST_URI"]; $wppapos = stripos($uri, '/wppaspec/'); if ($wppapos && get_option('permalink_structure')) { // old style solution, still required when qTranslate is active $plugins = implode(',', get_option('active_plugins')); if (stripos($plugins, 'qtranslate') !== false) { $newuri = wppa_convert_from_pretty($uri); if ($newuri == $uri) { return; } // Although the url is urlencoded it is damaged by wp_redirect when it contains chars like ë, so we do a header() call header('Location: ' . $newuri, true, 302); exit; } // New style solution $newuri = wppa_convert_from_pretty($uri); if ($newuri == $uri) { return; } $_SERVER["REQUEST_URI"] = $newuri; wppa_convert_uri_to_get($newuri); } }