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.
Need to avoid redirect to webhost homepage
Moderator: General Moderators
- Tiancris
- Forum Commoner
- Posts: 39
- Joined: Sun Jan 08, 2012 9:54 pm
- Location: Mar del Plata, Argentina
Re: Need to avoid redirect to webhost homepage
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.
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.