WordPress – All the IP Addresses of Comments are Same and of Local Server

Recently I walked into a very interesting situation with this blog. As many of you may know that this blog is hosted on Linux server and runs with MySQL and PHP. Self-hosted WordPress is the platform for this blog.

Recently I started to notice that after some updates on platform, all the comments on the blog posts have exactly the same IP Address. This started to create a major problem for me. As most of you know malicious attacks and spamming is a common problem everywhere. This blog also receives lots of spam messages and it is very important that spams are filtered out so I can respond to all the valid comments.

However, now all the comments contain the same IP address and that also of the my server’s IP address, it was very difficult for the spam catcher plugin to catch all the spams. After reading through quite a many spam comments, I decided to fix this problem for good.

Here is the solution I applied.

I went to php.config which is in the root folder of public_html and added following lines in the code.

if($_SERVER['HTTP_X_REAL_IP']){
$_SERVER['REMOTE_ADDR'] = $_SERVER['HTTP_X_REAL_IP'];}

Once I applied to above mentioned line, everything was back to normal. All the comments in the WordPress, started to show the IP address of the original individuals.

WordPress - All the IP Addresses of Comments are Same and of Local Server wpcomments-800x176

Well, that’s it. A very simple solution to a complicated problem.

Reference: Pinal Dave (https://blog.sqlauthority.com)

WordPress
Previous Post
WordPress – How to Rollback Plugin or Theme Changes? – WP Rollback
Next Post
SQL Authority News – 11 Years of Daily Blogging – 4200+ Blog Posts

Related Posts

2 Comments. Leave new

Leave a Reply