In index I can write this –
if ($_SERVER['HTTP_HOST'] != 'www.example.com') {
include("home.php")
}
But it’s very easy to remove this checking and just include the home.php which will run the whole website for any domain name.
Is there any encoded way which cannot be removed to make this website work for other domains?
If one has access to your code, and can change it, there is no way you can prevent this from happening.