Safe Redirect (Preserving Parameters)

Works with wp_redirect() and direct headers. Automatically validates safe URLs and optionally transfers =* parameters from the current URL.

// Basic:
CFGP_U::redirect('https://example.com/sr/', 302); // Safe auto-check

// Transfer dynamic GET parameters: put =* in target URL
CFGP_U::redirect('https://example.com/offer?name=*&surname=*', 302);

// Example: redirect by country
if ( CFGP_U::check_user_by_country('DE') ) {
    CFGP_U::redirect('https://example.com/de/', 307);
    exit;
}
Was this page helpful?