PDA

View Full Version : File Not Found


smokey
31 May 2001, 22:49
Have vbulletin handle your 404 errors instead of a seperate page. This hack is aimed at people who use vbulletin on a seperate subdomain or domain from there accual site. Example would be www.myforums.com or forums.mysite.com but im sure it would work if ut url is like www.mysite.com/forums

The zip file contains the following files:

notfound.php - Main file for the script
install_404.php - File to install the templates for this script
.htaccess - The file that calls up notfound.php for the 404 error instead of the server defualt
ToDo.txt - Just a small file with instructions on where to upload the files. ;)

Please note that this may not work on all servers, if this does not work, contact your server admin and see what you can do, he/she may have to make the notfound.php the defualt 404 handler for your board.

Enjoy!

JohnM
03 Jun 2001, 04:38
note that this will only work on apache servers

you might be able to get your webhost to set the php script to be the 404 error page on other servers.

smokey
03 Jun 2001, 04:54
thanx for the tip john

SNA
03 Jun 2001, 17:02
Why does this work with the forums but not with other virtual hosts?


This works:
<VirtualHost xx.xx.xxx.xxx:80>
ServerName forums.mysite.com
DocumentRoot /pathtoforums/messageboard
ErrorDocument 404 /notfound.php
</VirtualHost>


Then i made a new notfound.php with jus TEST in it...

and put it in the root of the this virtualhost

<VirtualHost xx.xx.xxx.xxx:80>
ServerName www.mysite.com
DocumentRoot /pathtoforums/test
ErrorDocument 404 /notfound.php
</VirtualHost>

The only way to get it to work was to do this...

<VirtualHost xx.xx.xxx.xxx:80>
ServerName www.mysite.com
DocumentRoot /pathtoforums/test
ErrorDocument 404 http://www.mysite.com/notfound.php
</VirtualHost>


Now the $REQUEST_URI doesnt work... it just shows /notfound.php not the page I was orginally trying to access.... any ideas?


Thanks,

smokey
03 Jun 2001, 21:38
Well the REQUEST_URI dont work because u put the full url in it. When it is /notfound.php then it uses the file that was requested. Now adding the error document to the dns, if the only way it works is by entering the full url to the notfound.php, then hyst edit the file_not_foundbit template and remove that part, i hope that helps. Also did u try using the .htaccess?

SNA
03 Jun 2001, 21:56
Smokey maybe you missunderstood me.. Your hack works great!

I was just trying to add a /notfound.php to my other virtual hosts and its not recognizing it.. i think its somehting with the Cache.. cause when I use lynx to bring up the page it does redirect properly... nice hack ....

smokey
03 Jun 2001, 22:00
lol, yeah i am like half asleep... ;) thanx