PDA

View Full Version : Create 404 Page


ALBCODERS
29 Jun 2010, 20:03
I am not a proffessional Coder but I just fixed a 404 page for my Forum.
If you want to create one follow me;

Crate a new template wich will called 404_error on your style:



Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------


Change the text (( PUT YOUR CODE OR IMAGE HERE )) whith your Code that you want.

So Now you need a 404.php lets create one;



Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



Now open .htaccess file and add this ;


Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------

wolfe
01 Jul 2010, 18:42
nice also used this to do a 500 error page ;)

apokphp
25 Jul 2010, 02:58
Can't get this to work (I'm using 4.0.5). This is the error message I get:

Warning: require_once(./global.php) [function.require-once]: failed to open stream: No such file or directory in /home/apokodn/public_html/404.php on line 32

Fatal error: require_once() [function.require]: Failed opening required './global.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/apokodn/public_html/404.php on line 32

This is apparently the code in question:


Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------




I can change my .htaccess and use your link (to your 404.php) and it works fine. But with my own link to my own 404.php file, I get errors.

This is my .htaccess file:


<Files 403.shtml>
order allow,deny
allow from all
</Files>

deny from 128.241.46.107
deny from 199.67.140.154
deny from 199.67.140.83
deny from 209.136.124.178
deny from 24.255.4.133
deny from 65.73.24.110
deny from 68.0.166.100
deny from 68.105.138.218
deny from 68.111.15.15
deny from 68.226.22.66
deny from 68.231.184.133
deny from 68.231.185.12
deny from 68.231.185.219
deny from 68.231.189.51
deny from 69.9.30.7
deny from 72.211.152.125
deny from 72.211.156.96
deny from 72.211.157.157

RewriteEngine On
ErrorDocument 404 http://www.onlinedebate.net/404.php

ErrorDocument 403 /403.shtml

ErrorDocument 500 /500.shtml

RewriteCond %{HTTP_REFERER} !^http://onlinedebate.net/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://onlinedebate.net$ [NC]
RewriteCond %{HTTP_REFERER} !^http://www.onlinedebate.net/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://www.onlinedebate.net$ [NC]
RewriteRule .*\.()$ - [F,NC]

ALBCODERS
25 Jul 2010, 12:52
Try this :



Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



I dont have 4.0.5 my last version is 4.0.3

apokphp
25 Jul 2010, 19:39
This is the error I get now:


Warning: require_once(./global.php) [function.require-once]: failed to open stream: No such file or directory in /home/apokodn/public_html/404.php on line 11

Fatal error: require_once() [function.require]: Failed opening required './global.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/apokodn/public_html/404.php on line 11

apokphp
25 Jul 2010, 19:44
I suspect the issue is w/ the global. I recall reading in another thread that 4.0.5 does something differently in its global calls.

River J
28 Jun 2011, 07:47
there's easier ways to do this :p