Page 1 of 1

Need to avoid redirect to webhost homepage

Posted: Mon Jan 09, 2012 1:09 pm
by drayarms
Hello, I never really gave a serious thought to the above question until now that I'm trying to actually launch a live site. Well I'm sure most of you are familiar with this situation, where a user my enter a wrong, non existent url, whose root happens to be your domain name. For example, instead of entering domain.com/greetings, the user may wrongly type domain.com/grewtings . How can I make my site to redirect such erroneous urls to my homepage, instead of to my webhost's homepage with an error message?

Appreciate all answers.

Re: Need to avoid redirect to webhost homepage

Posted: Mon Jan 09, 2012 1:45 pm
by Tiancris
If you have an htaccess file, then add the following line:

ErrorDocument 404 /index.php

or may be redirect to an error page:

ErrorDocument 404 /error.php

Thus, for any invalid access, the visitor will be redirected to the specified page.