Redirect old homepage to the new one within the same site

Ideally, the blog subdomain would point to a different filesystem location (its own document root), then you could use a simple Redirect directive in its own .htaccess file in the root of the subdomain. For example: Redirect 301 / https://www.example.com/ratgeber/ The Redirect directive is prefix-matching and everything after the match is copied onto the end … Read more

wp_redirect() doesn’t work

The problem is not what you are doing, but when you are doing it. When your browser requests a webpage, that webpage arrives with a set of HTTP headers, followed by a HTTP body that contains the HTML. Redirection is done via a HTTP header. The moment you echo, or printf or send any form … Read more

Add a simple php code snippet to redirect a single wordpress url to another

Alright, so I found the solution, it was a simple change in the request object class variable: function redirect_workaround( $request ){ if( $request->request === ‘myspecialurl’ ) { $latest = new WP_Query( array( ‘category_name’ => ‘myspecialcategory’, ‘posts_per_page’ => 1 ) ); if( $latest->have_posts() ){ wp_redirect( get_permalink( $latest->post->ID ) ); exit; } } } add_action( ‘parse_request’, ‘redirect_workaround’ … Read more

Post Migration Site Migration Redirects All Known Solutions Attempted

Can you check the wp-config.php file and make sure it’s not being set by the WP_HOME and/or the WP_SITEURL constants? If you set the WP_HOME and WP_SITEURL constants in the wp-config.php file to webinar.example.test, but have the home and siteurl options in the wp_options table set to staging.webinar.example.org, then running the wp option get siteurl … Read more

How to redirect to a page after submitting form data?

Form handling needs to happen in functions.php (or equivalent) so that it triggers before headers are sent. Here is the how I achieved redirection after form submit: add_action(‘init’, ‘redirectAfterSubmit’); function redirectAfterSubmit() { if (isset($_POST[“submit”])) { insert_row(); wp_redirect( “/thank-you”, 301 ); die(); } } function insert_row(){ // form handing here }