How Redirecting A URL to a 404 Stopped A Spammer

guest blog spammerToday I wanted to share with you a new technique I just learned about the beginning of this week and how I used it and what I needed it for.

I have a client who accepts guest posts on their blog and normally the guest bloggers just go about doing a few social shares and a minimal amount of linking to their post on my client’s site, which is a good thing for both parties.

Anyways, I monitor the backlinks that show up for this client’s site on a regular basis and noticed one of these guest bloggers was causing my client’s blog some issues.

Links from mass commenting were the main links showing up in my reports, yet there were just about every type you could think of, all coming from really crappy, low quality sites.  Just the kind of links you really do not want for any authority site whatsoever.

To-date these links were not causing ranking issues, however the writing is on the wall for something to happen and we wanted to prevent it.

So how does someone stop these kinds of links coming into your site?

To be honest, there is no iron curtain that you can build to stop this from happening, but there is this new technique I learned that does repair things.

Before I discuss what I did, I want to give credit to the person I learned this from and her name is Jenny Halasz over at Searchengineland.com. She wrote a post titled ‘Manual Spam Action Revoked! A Case Study’ which gave me the idea to implement the technique on my client’s blog. Thanks to Jenny for her idea!

What I Did To Stop The Spam Links To The Problem Post

Luckily the links being built to my client’s blog were only going to one location, the guest bloggers post. This made it easy to identify the culprit and also rectify the problem. I suppose if they were building links to many locations on the website then this technique could not have been applied. Good thing they weren’t doing that right? J

To stop these backlinks from causing a site issue I did two things which did not take a lot of time and should give a positive end result, without having to go about doing a disavow with Google (My Article about Using the Disavow Tool) or email other site owners a link removal request.

The first thing I did was rename the slug in WordPress. (The slug is the actual URL of the post after the domain) This resulted in the links not directly linking anymore, however it did not solve the problem because WordPress automatically does a 301 redirect when you rename or move a post such as I did. I needed a 404 not a 301 in this case, which may leave you with a question asking why? (My Article about 301 redirects and 404 error pages)

The reason why I needed the 404 was because when back links go to a 404 they are disregarded by Google completely, therefore they have no positive or negative effect on a site. Yes I could have deleted the post altogether as another way to eliminate the problem, yet the post is well-written and good content for the website.

After renaming the slug I now needed to do the 404 and with WordPress you have a couple of options. One is to install the redirection plugin and you can set-up the redirects there. I tried this method, but the end result was horrible due to the fact my client’s site has a blog and a store, which resulted in the redirection plugin was effecting the store urls also.

Therefore a typical redirect like this example below does not work correctly for the problem I had.

RewriteCond %{HTTP_HOST} ^domainname\.com$ [OR]

RewriteCond %{HTTP_HOST} ^www\. domainname\.com$

RewriteRule ^old\blog\post\/?$ “http\:\/\/www\. domainname\.com\/” [R=301,L]

I tried solving this by using the redirection inside of cpanel without any luck and realized I needed to change the redirection in the .htaccess file manually for WordPress only.

WordPress when installed creates this code in the htaccess file for you.

# BEGIN WordPress

RewriteEngine On

RewriteBase /

RewriteRule ^index\.php$ – [L]

RewriteCond %{REQUEST_FILENAME} !-f

RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule . /index.php [L]

# END WordPress

Problem Solved

This code is for redirection of the blog to either the main domain root or you can add a subdirectory and it will route the user to that location. Knowing this I just needed to add a line of code to redirect the old post’s URL to a 404 page. It was pretty simple and resulting code looked like this:

# BEGIN WordPress

RewriteEngine On RewriteBase /

RewriteRule ^index\.php$ – [L]

RewriteRule ^general/blog-post-slug/$ http://www.domainname.com/404.php [R=301,L]

RewriteCond %{REQUEST_FILENAME} !-f

RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule . /index.php [L]

# END WordPress

After this simple addition of code into the htaccess file all those incoming spammy links are now sent to a 404 page. With this I know now the problem is solved for this circumstance of being bombarded with bad links from a spammer.

Thanks For Reading My Blog

You Can Also Find Me on ...

Find Out More About me Click Here

Author: Dwight

Share This Post On

Submit a Comment

Your email address will not be published. Required fields are marked *

Pin It on Pinterest

Shares
Share This