Site icon PeterStavrou.com

404 Redirection WordPress Plugin Subdirectory Fix

404 Redirection WordPress Plugin

404 Redirection by flippingwp is a simple but very useful WordPress plugin that permanently redirects all 404’s (Pages Not Found) to your Homepage.
There are several reasons why you would want to redirect pages that are not found to your homepage but the main two are:
1. To help Search Engine Optimization (SEO).
2. To help with the overall user experience.

 

404 Redirection WordPress Plugin Subdirectory Fix

I’m personally a big fan of this plugin but recently I noticed that people who have install their WordPress website in a subdirectory are experiencing an issue were missing pages are being redirected to the WordPress subdirectory instead of the actual Homepage URL.

It is very easy to fix this issue and here’s how:

1. In your WordPress Admin Dashboard click on Plugins.

2. Find the 404 Redirection plugin and click on Edit.

3. Inside the box where the plugin’s code is stored scroll to the bottom and you should see the below code:

function redirect_all_404s() {
global $wp_query;
if ($wp_query->is_404) {
wp_redirect(get_bloginfo('wpurl'),301);exit;
}

4. Replace the below line:

wp_redirect(get_bloginfo('wpurl'),301);exit;

with this:

wp_redirect(get_bloginfo('url'),301);exit;

Did this solution fix your 404 Redirection WordPress Plugin problem?

Exit mobile version