How to prevent redirect 301

Did you check the ‘options’ table in your WP databasse for the two instances of the domain name (something like ‘http://www.example.com ‘ ). Not clear if your pre-production site is hosted on a local machine, or networked server. Might be some firewall redirection rules causing issues.

Duplicated WP site manually, now links redirect wrong [closed]

Found the issue: in wp-config.php, there was no http:// before the address on the define(‘WP_HOME’ line. From WordPress Codex: Add these two lines to your wp-config.php, where “example.com” is the correct location of your site. define(‘WP_SITEURL’,’http://example.com’); define(‘WP_HOME’,’http://example.com’); Adding these properly solved the issue.

Redirect all links form a category to new links on new category

Using Apache I’d go with an .htaccess rule RewriteRule ^test/(.*) http://www.example.com/demo/$1 [R=301,L] so http://www.example.com/test/page would now go to http://www.example.com/demo/page and the 301 redirect would make it permanent make sure you put your rewrite rule after these rules RewriteEngine on RewriteBase / Using Nginx in the server block server { . . . rewrite ^/test/(.*) http://www.example.com/demo/$1 … Read more

Redirect to home if page doesn’t exists [duplicate]

You can use this code inside your 404.php template file to safely redirect to users to homepage: wp_safe_redirect(site_url()); exit(); Use this code before every line of code in your 404.php. This will redirect everyone who visits the 404 page to the website’s home URL, which would be what you are looking for. You don’t have … Read more

Redirect only Blog posts to new

What you’ll want to do is, check if it is a post via is_single(), get the current URL (or at least that part after the domain), and redirect to the new domain. Here I am using parse_url() to easily differentiate between host, path, etc. add_action(‘template_redirect’, ‘wpse_redirect_posts_to_new_page’); function wpse_redirect_posts_to_new_page() { // if this is not a … Read more

Bedrock WordPress

Check your .env file. It should be sth like this: WP_ENV=production WP_HOME=http://yourdomain.com WP_SITEURL=${WP_HOME}/wp Also check that your DocumentRoot in Apache config points to /path/to/your/website/web https://roots.io/bedrock/docs/installing-bedrock/ You could also check in discourse from Roots for a problem like that: https://discourse.roots.io/