Server Migration - Pipe Tar from Server to Server using Netcat

If you need to transfer a large amount of data from one server to another you might normally create a large tar archive, send it across and then untar it on the other end. However a slightly slicker and easier repeated way of doing this is to pipe tar directly from one server to the other doing all three steps in one go. For this you would create a script on each server. Read On →

C-Panel Access using WHS/Root Password

Ever wondering how you could gain access into any Control panel(c-panel) account when you confidently know only the username of the c-panel account. I tried doing this by actually using the Web host manager (WHS) password, and it worked brilliantly for any c-panel user account. But the only gotcha I found out was that I could not use Phpmyadmin. Nevertheless, you could still find a way around this by adding a PHP database management file on the web root directory which installs an alternative database management User interface which provides functions similar to Phpmyadmin.

Server Migration - Synch Cron Tab via SSH

If you are handling a server migration and would like to have a scripted way to copy the crontab from one machine to the other then you might like this little snippet. ssh -p2020 root@123.123.123.123 'crontab -l' | crontab - This will get the contents of the root crontab from one server and apply it to the current server, replacing any current cron tab settings. This is nice if you Read On →

Crawl an xml sitemap quality check 301 and 404

On occasion, google and other tools will tell you there’s errors with your sitemap.xml file and not give you the information of what exactly is wrong, so we wrote this little tool to crawl the sitemap and check for 301 redirections and 404 errors. It is a noddy file and should have much more error handling etc but here’s the basic flow :- <?php $screenwidth = 80; function trimstr($str, $maxlength = -1, $middle = '...') { global $screenwidth; if ($maxlength == -1) { $maxlength = $screenwidth - 1; } if (count($str) > $maxlength) { $partlength = round($maxlength - count($middle) / 2); $leftpart = substr($str, 0, $partlength); $rightpart = substr($str, 0-$partlength); return $leftpart . Read On →

PHP Split String on Word Break (No Regex or Arrays, Dead Simple)

Need to take a string of text and shorten it down but make sure you split on a word break? This little snippet might be exactly what you are looking for. $text=substr($text, 0, strpos($text, ' ', 50)); effectively you are saying give me the position of the first space after character 50 and then chop the string there.

Check 301 redirects in htaccess file

This is post is now quite old and the the information it contains may be out of date or innacurate. If you find any errors or have any suggestions to update the information please let us know or create a pull request on GitHub Often you will come across a situation where you have to do a mass of redirects, often when moving platform e.g. from osCommerce to Magento. So you might create a whole load of .htaccess rules which you want to verify, either before or after implementing them. Read On →