In index I'm able to write this -

if ($_SERVER['HTTP_HOST'] != 'www.example.com') 

But it is easy to get rid of this checking and merely range from the home.php that will run the entire website for just about any domain title.

Can there be any encoded way which can't be removed to create this site work with other domain names?

If a person can access your code, and may change it out, there's no method for you to stop this from happening.

If you are using apache, you are able to disallow use of "home.php" directly with the addition of personal files known as ".htaccess" towards the directory which home.php is within:

<Files home.php>

  order deny,allow

  deny all

</Files>

But better still, I'd put home.php along with other files inside a protected directory known as "includes" and employ this ".htaccess" file rather:

<Directory "includes">

  order deny,allow

  deny all

</Directory>

Now you can only access home.php by utilizing include("home.php") inside a script.

Whether it does not work, make certain that htaccess overrides are enabled inside your apache configuration. Discover the "AllowOverride" directive and make certain "AllowOverride All" is placed.