preventing from a use to get to a 404 page
Moderator: General Moderators
- pelegk2
- Forum Regular
- Posts: 633
- Joined: Thu Nov 27, 2003 5:02 am
- Location: Israel - the best place to live in after heaven
- Contact:
preventing from a use to get to a 404 page
i am running php over apache
is there a way to prevent from a user from hetting to unexisting page?
for exampl
if the user type by mistake :
page1.ph
instead of page1.php
i want him in this case to go to a certin page!
how do i do that?
thanks in advance
peleg
is there a way to prevent from a user from hetting to unexisting page?
for exampl
if the user type by mistake :
page1.ph
instead of page1.php
i want him in this case to go to a certin page!
how do i do that?
thanks in advance
peleg
i'm assuming you are using Apache..
Create a file called .htaccess in the root directory of the server (the one you refer to as '/') and enter your error handlers in the following format, one per line:
ErrorDocument [3-digit code] [action]
For example, you can point to a custom 404 page like this:
ErrorDocument 404 /errors/custom404.html
You can also simply have it display some other text:
ErrorDocument 404 "Sorry, this page doesn't exist.
Make sure you begin the text with a quote (").
Windows users have reported problems creating .htaccess files. Create a file named 'htaccess.txt', FTP it to your web host, and then rename it to .htaccess.
You can even make your 404 errors more friendly for international visitors by displaying a page in their own language. Check out this Apache article.
Just make sure you create a 404.htm page that tells the user the page could not be found,a nd then insert it as described above.
Create a file called .htaccess in the root directory of the server (the one you refer to as '/') and enter your error handlers in the following format, one per line:
ErrorDocument [3-digit code] [action]
For example, you can point to a custom 404 page like this:
ErrorDocument 404 /errors/custom404.html
You can also simply have it display some other text:
ErrorDocument 404 "Sorry, this page doesn't exist.
Make sure you begin the text with a quote (").
Windows users have reported problems creating .htaccess files. Create a file named 'htaccess.txt', FTP it to your web host, and then rename it to .htaccess.
You can even make your 404 errors more friendly for international visitors by displaying a page in their own language. Check out this Apache article.
Just make sure you create a 404.htm page that tells the user the page could not be found,a nd then insert it as described above.
- pelegk2
- Forum Regular
- Posts: 633
- Joined: Thu Nov 27, 2003 5:02 am
- Location: Israel - the best place to live in after heaven
- Contact:
ok i understood almost everythin
i didnt execlly understand ho to call execlly the file name?
the apache server it on my pc so i dont have poblem to access it
so how execly do i call the fil "htaccess'" the exclly file name?
thanks alot
peleg
the apache server it on my pc so i dont have poblem to access it
so how execly do i call the fil "htaccess'" the exclly file name?
thanks alot
peleg
- pelegk2
- Forum Regular
- Posts: 633
- Joined: Thu Nov 27, 2003 5:02 am
- Location: Israel - the best place to live in after heaven
- Contact:
i dint know why it isnt working
i hae opened a file called :
then i wrote in it :
and still nothin
and even estarted the derver
and putted the file in the root
any idea?
Code: Select all
<?php
.htaccess
?>Code: Select all
<?php
ErrorDocument 404 "Sorry, this page doesn't exist.
?>and even estarted the derver
and putted the file in the root
any idea?
- pelegk2
- Forum Regular
- Posts: 633
- Joined: Thu Nov 27, 2003 5:02 am
- Location: Israel - the best place to live in after heaven
- Contact:
i even tried to make changes at
conf/httpd.conf
and it didnt help:(
what to do??
and it didnt help:(
what to do??
-
jollyjumper
- Forum Contributor
- Posts: 107
- Joined: Sat Jan 25, 2003 11:03 am
Hi Peleg,
Open notepad.
Paste these 4 lines in it:
ErrorDocument 500 /error.htm
ErrorDocument 404 /error.htm
ErrorDocument 401 /error.htm
ErrorDocument 403 /error.htm
Select File, Save as
Select All files in the Save file dialog box.
Type .htaccess and press the save button.
Upload the .htaccess file to the root folder of your webserver.
Create a file called error.htm and upload this in the root folder of your webserver.
Call a file that doesn't exist and it should show the content of your self made error.htm
Hope this helps you.
Greetz Jolly.
Open notepad.
Paste these 4 lines in it:
ErrorDocument 500 /error.htm
ErrorDocument 404 /error.htm
ErrorDocument 401 /error.htm
ErrorDocument 403 /error.htm
Select File, Save as
Select All files in the Save file dialog box.
Type .htaccess and press the save button.
Upload the .htaccess file to the root folder of your webserver.
Create a file called error.htm and upload this in the root folder of your webserver.
Call a file that doesn't exist and it should show the content of your self made error.htm
Hope this helps you.
Greetz Jolly.
- pelegk2
- Forum Regular
- Posts: 633
- Joined: Thu Nov 27, 2003 5:02 am
- Location: Israel - the best place to live in after heaven
- Contact:
still isnt working
maybe something else ineed to define to so i will work?