Are you looking to stop WordPress 404 visits?
We bet that you didn’t even know something is happening to your website that could cause you to miss out on some important visits or even worse some conversions.
If there is a hyperlink out there in the web atmosphere that has unwanted space either at the beginning or the end, this URL if clicked on will generate a 404 visit on your website.
This means that the person who has actually clicked on the hyperlink will never reach the destination they are hoping for. Instead, it is going to take them to whatever 404 error page you have set up on your website.
This is extremely common because if you are getting back links to the content on your website it is possible that those people that are creating these back blinks are not hyperlinking to the URL properly.
There are spaces in these URLs that are backlinks to your content and because of the spaces, the visitor is never reaching the correct destination.
The good news is that there is an easy fix for this that can auto-magically remove any spaces that are part of a hyperlink coming into your website.
Before we dive into the actual process of fixing this let’s talk about how you can actually see if you do have any of these miss-formatted hyperlinks coming into your website.
Follow these simple steps below to set up a 404 monitoring plugin and see what URLs are triggering 404 visits to your website.
STEP #1 Install 404 Monitoring Plugin – Stop WordPress 404 Visits
404 Solution is a FREE plugin that provides the following features below.
Features:
- Highly configurable – redirect specific 404 URLs to any existing page.
- Automatically create redirects based on the URL the visitor was most likely trying to visit.
- Get a list of 404s as they happen.
- View logs of 404 pages and redirects including referrer data.
- WooCommerce compatible – pages, posts, products, and custom post types are supported.
- Display a list of page suggestions on a custom 404 page with a shortcode (any page can be a custom 404 page).
- Basic plugin usage statistics.
- Automatically remove redirects when the URL matches a new page or post.
- Automatically remove manual and automatic redirects once they are no longer used.
- Redirect based on regular expressions and include query data.
Once this plug-in is installed and set up it will begin to capture all of the URLs that are coming into your website and creating a 404 error.
See an example of this report in the image below.
GET THE PLUGIN HERE – Stop WordPress 404 Visits
The URLs coming in that are generating 404 errors may look something like this below.
https://some_domain.com/about:blank
If you see this path inside of your 404 log then this is being caused by a hyperlink coming to your website that has empty space in it.
So now hopefully you have a better understanding about how to track down these 404 visits and now it’s time to explain how to easily fix them.
Stop WordPress 404 Visits – Add this to your .htaccess file
You simply need to take the below code snippet and add it to your .htaccess file.
What this snippet will do is remove any spaces that are in the hyperlink coming to your website and either the beginning or the end of the URL path.
# remove spaces from start or after /
RewriteRule ^(.*/|)[\s%20]+(.+)$ $1$2 [L]
# remove spaces from end or before /
RewriteRule ^(.+?)[\s%20]+(/.*|)$ $1$2 [L]
# replace spaces by - in between
RewriteRule ^([^\s%20]*)(?:\s|%20)+(.*)$ $1-$2 [L,R]
Hopefully, this was helpful and it is a great tip to decrease the amount of 404 visits you are getting on your website and ensure that even if a backlink is copied and formatted incorrectly with added space it will still reach the intended destination.
If you have any questions at all feel free to comment below.
Post a Comment
Don't try to insert your link to make Spam your comment.