Redirect old domain to new domain with 301

Here are the few lines of code you can add into your .htaccess to redirect your old domain to new domain with 301 (permanent redirect) code.

Open .htaccess file in any editor and add following below lines, please replace with your own domain.

RewriteEngine On
RewriteCond %{HTTP_HOST} ^ [NC,OR]
RewriteCond %{HTTP_HOST} ^ [NC]
RewriteRule ^(.*)$$1 [L,R=301,NC]


That’s all 🙂

Check active connections to web server – DDOS solution

Here are few commands to check the active connection to apache or to any other web server, you can block IPs having too many connections :

Login to SSH and execute following commands with root access:

1.To see what IPs are connecting to server and how many connections exist from each IP:

netstat -anp |grep 'tcp\|udp' | awk '{print $5}' | cut -d: -f1 | sort | uniq -c | sort -n

2.To see how many connections each IP on the server is receiving:

netstat -plan |grep :80 | awk '{print $4}' | cut -d: -f1 | sort | uniq -c | sort -n

3.Get total current active connections to Apache:

netstat -apn | grep :80 | wc -l

Get Apache status update from command line to see which domain is receiving maximum hits (cPanel/WHM server):

lynx http://localhost/whm-server-status

Read More

Update MySQL database for centos web panel

Here are simple steps to update MySQL database server 5.1 to MySQL database server 5.6 for Centos web panel:

Login to your server with root username and password from SSH:

1.  Create full database backup (In case mysql server break we have backup to restore).

mysqldump --events --all-databases | gzip > /home/alldatabases.sql.gz

2. Install Remi repo

cd /etc/yum.repos.d

Read More

DDOS attacks on XMLRPC.php (Fixed)

wordpressXMLRPC.php is php file included with wordpress installation, it allows posting of content remotely through supported web blogs to wordpress blog, it provide many other features as well having many pros and cons. As far as web site security is concerned XMLRPC.php file is famous among hackers and attackers.

Most of the wordpress blogs get hits by attackers on XMLRPC.php usually called DDOS attacks. During the attack XMLRPC.php gets many requests and that makes web site goes down with excessive usage of allocated resources. Some web hosting providers suspend those accounts for high resource usage issues. Read More

Unable to install yum-rhn-plugin, please contact CloudLinux (Fix)

cloudlinuxFew days back i got error Unable to install yum-rhn-plugin, please contact CloudLinux support at  on one of our shared web hosting server while installing CloudLinux, I googled it but not able to found any proper solution, i have re-installed cPanel/WHM from scratch but no luck. This issue mostly appears on OVH Servers as they use their own cPanel/WHM and CentOS kernels which got few bugs in the repositories. I contacted cloudlinux support they provided me single command that fixed this issue immediately.

You can also run this command in SSH to fix out the repositories issue:

# rpm -e --nodeps libxml2-devel

Running up above command will fix this issue for sure as tested.

Read More