How to Redirect Your Elgg Site from to

There has been a lot of discussion on how to safely redirect an Elgg address when the “www” part of the url is omitted.  There is a lot of documentation on how to do this directly in the .htaccess file. However, any wrong modification could hurt your Elgg site and make it unaccessible. In this article, I will give you step by step guide on how to  redirect your Elgg site from to

1. First, go to YourElggFolder/views/default/page_elements and open the file header.php

2. Add this code at the top, after the <?php tag:


{header( ‘Location:’);

if($_SERVER[‘SERVER_NAME’]==””){header( ‘Location:’);exit;}

3. Save it. Now try to access your site without the “www” part in the url. You will see that it automatically redirects to the site with the complete url. If you are using a custom theme, do the same process, but instead, go to the header.php file of the custom theme.

This concludes how to redirect your Elgg site from to

Looking for quality Elgg Hosting? Check out Arvixe Web Hosting.

Happy Hosting!

Rodolfo Hernandez

Tags: , , , , , , | Posted under Elgg | RSS 2.0

Author Spotlight

Rodolfo Hernandez

I like photography and reading books. Currently working for Arvixe as Elgg Community Liaison. Elgg Security Expert Web Security Expert CEO of UDP SW Social Web

Leave a Reply

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