New domain!

And finally I decided to buy another hosting plan + domain(really cheap actually) Unfortunately is already taken, but I like this one as well

If you try to open a link from the old site, you will end-up in the same page, but on the new site – and this works with literally 18 lines of code :)))

I left the active theme on the old site stripped down to the minimum(index.php – empty, style.css – just the description of the theme, functions.php – only the redirecting function) in order to make the redirection as quick as possible.

The moving of the files themselves was quite quick, thanks to my favourite cPanel, which supports compressing/extracting of archive files. So instead of downloading and then uploading 1000+ files, I just downloaded 1, which I extracted here

Database export, some SQL queries after the import on the new server, and it was like nothing ever happened

So, here is the code for the redirect, and that will be all for this evening

function curPageURL() {
$pageURL = 'http';
if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";}
$pageURL .= "://";
if ($_SERVER["SERVER_PORT"] != "80") {
} else {
return $pageURL;

function redirect_to_new_domain() {
$requested = curPageURL();
wp_redirect(str_replace('', '', $requested), 301);
add_action('init', 'redirect_to_new_domain', 1);

Leave a Reply

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