How to reduce 404 errors created by ++liker.profile_URL++

Are you getting lots of 404 errors in the log because of some urls having patterns like ” ++liker.profile_URL++ ” ? How to reduce 404 errors created by ++liker.profile_URL++ ? Here is the solution to stop those 404 errors and convert those urls to result in 301 permanent redirects to your homepage.

Problem:
Some days back, when I saw the log created by Better WP Security plugin installed on my blog, there were a lot of 404 errors because of some weird URLs something like this:

  1. subharanjan.com/subharanjan.com/subharanjan.com/remove-or-override-functions-attached-to-a-specified-filter-hook/++liker.profile_URL++
  2. subharanjan.com/++liker.profile_URL++

I tried to find out about this and seems like this is a link dropping spambot. I am not sure what exactly it does but here is a solution to stop this.

Solution:

  • Open you .htaccess file.
  • Add these lines below into your .htaccess file which can be found at the root of your WordPress installation.
    # -------- find and redirect to index.php ---------------------------------------
    RewriteCond %{REQUEST_URI} ^(.*)++liker.profile_URL++* [NC]
    RewriteRule ^(.*)$ /index.php [R=301,L]
    # -------------------------------------------------------------------------------
    Add these lines before the lines( url rewrites ) added by WordPress for permalink support. It should look like this:# -------- find and redirect to index.php ---------------------------------------
    RewriteCond %{REQUEST_URI} ^(.*)++liker.profile_URL++* [NC]
    RewriteRule ^(.*)$ /index.php [R=301,L]
    # -------------------------------------------------------------------------------
    # BEGIN WordPress

    RewriteEngine On
    RewriteBase /
    RewriteRule ^index.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]

    # END WordPress

  • Save the .htaccess file and check by accessing one of the urls having ++liker.profile_URL++ and see if it results in a 404 Page not found error OR simply redirects to your home page.

Explanation of the above htaccess code snippet:
RewriteCond will be looking for the pattern “++liker.profile_URL++” in the requested urls. Once it finds that piece of text in the requested url, it will redirect the request to home page in place of creating a 404 error as mentioned in the RewriteRule section.

RewriteRule defines a particular rule.
The first string of characters after RewriteRule defines what the original URL looks like.
The second string after RewriteRule defines the new URL. This is in relation to the document root (html) directory. / means the html directory itself, and subfolders can also be specified.

  • ^ begins the line to match.
  • . stands for “any non-whitespace character”
  • * means that the previous character can be matched zero or more times.
    So, ^uploads.*$ matches uploads2009, uploads2010, etc.
    ^.*$ means “match anything and everything.” This is useful if you don’t know what your users might type for the URL.
  • () designates which portion to preserve for use again in the $1 variable in the second string. This is useful for handling requests for particular files that should be the same in the old and new versions of the URL.
  • [NC] matches both upper- and lower-case versions of the URL.
  • [R=301,L] – this performs a 301 redirect and also stops any later rewrite rules from affecting this URL. It’s on the same line as RewriteRule, at the end.

Source: https://kb.mediatemple.net/questions/85/Using+.htaccess+rewrite+rules#gs

Comments

8 responses to “How to reduce 404 errors created by ++liker.profile_URL++”

  1. […] How to reduce 404 Errors created by ++liker.profile_URL++ […]

  2. Catatan Belajar Avatar

    Thanks, nice post. I have more 404 Error log, it may by bot.

  3. Doezer Avatar
    Doezer

    Hi,

    I used your snippet but it makes my website go into a 500 error.
    I have this error in my logs :
    RewriteCond: cannot compile regular expression ‘^(.*)++liker.profile_URL++*’

    Do you know why?

    1. Subharanjan Avatar

      There might be several causes for this 500 error. Make sure: you know what you are doing. Any problem with your .htaccess may make your site down.
      If you can provide me the whole htaccess code, then I can have a look.

    2. Gary C Avatar

      The Plus character “++” on the front and back have a unique meaning in .htaccess. Remove all of them.
      The wild cards (*) at the beginning and end will match “liker.profile_URL” and redirect to the index page.

  4. Jonathan Avatar

    I’m getting the same error as Doezer. My .htaccess file is quite long, due to W3TC cache rules. I’ve tried pasting the suggested code before W3TC and after, all of which are before the WordPress code.

    Are you sure you want the entire file posted here?

  5. Daniel Berhane Avatar

    Hello,

    I applied the codes to the .htaccess file of the document root folder of my website.

    HOWEVER, after that, I was unable to access the site as admin, yet the site was visible to readers. So, I had to remove the new codes!

    Can you help me figure out the cause of the problem?
    I noticed that unlike the instructions, my .htaccess file has this code
    IfModule mod_rewrite.c
    Could it be the problem?

    Thanx.

  6. Sachin Sharma Avatar

    Hi,
    Thank you for this article. Helpful. I have an another question though. The number of 404 errors have increased on my site, http://www.recaptoday.com. When user google recaptoday.com, it shows them pages that are been deleted from the site which results in 404 err. Any suggestions?

Leave a Reply

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