How to Show Custom Error Pages in 000webhost.com?

ganga22

Member
May 7, 2009
3
0
0
Colombo
How to Show Custom Error Pages in 000webhost.com?

I have Free Web hosting Account 000webhost.I want add custom Error Pages to My website. when user requested non-exist pages my on website it automatically redirect to http://error.000webhost.com/not_found.html. i want to stop this and redirect to my own page and display there are not such page


Friends, pls give me suggestions


Thanks
:)
 

melan1

Member
Jan 25, 2008
115
2
0
Matara
Hi,

if you web server using apache and it its using mod_rewrite. edit .htaccess file or create file named .htaccess if it is not already exits . you can add custom error pages according to Error code
such that
------------ .htaccess-----------------

RewriteEngine on
RewriteBase /
ErrorDocument 404 /err404.php
ErrorDocument 500 /err500.php
.....
.....
------------------------------------

i think 000webhost.com host on apache and mod_rewrite work on it
 

ganga22

Member
May 7, 2009
3
0
0
Colombo
Thanks

melan1 said:
Hi,

if you web server using apache and it its using mod_rewrite. edit .htaccess file or create file named .htaccess if it is not already exits . you can add custom error pages according to Error code
such that
------------ .htaccess-----------------

RewriteEngine on
RewriteBase /
ErrorDocument 404 /err404.php
ErrorDocument 500 /err500.php
.....
.....
------------------------------------

i think 000webhost.com host on apache and mod_rewrite work on it

Thanks my Friend,

it's work fine. but some codes in .htaccess are like Cryptic Language ( but these code are easy)
 

tann98

Member
Jan 9, 2011
1
0
0
000webhost ErrorDocument

my 000webhost site doesnt allow ErrorDocument 404, so i use mod_rewrite completely.

PHP:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^/?(.*)$ /404.php?url=$1 [L]
 

Spletnapot

Member
May 26, 2011
1
0
0
To use custom error pages on 000webhost, you need to create .htacces file and place it in public_html directory. In .htacces file you write:


ErrorDocument 403 /your403-error-file.php
ErrorDocument 404 /your404-error-file.php
ErrorDocument 500 /your500-error-file.php (or whatever error code you want)

(NO "RewriteEngine on , RewriteBase /" needed.)

At the end you also copy the custom error file (your403-error-file.php, for example) in public_html directory.

That`s all to make it work.