Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can Application.cfm direct to custom 404 page? 2

Status
Not open for further replies.

simmerdown

Programmer
Joined
Jun 6, 2000
Messages
100
Location
US
I've been hunting around, and it's still not quite clear to me ... should the<br><font color=#003366><FONT FACE=monospace>&lt;cferror type=&quot;request&quot; template=&quot;request_err.cfm&quot;&gt;</font></font><br>code in my Application.cfm allow me to have a custom 404 page? It hasn't worked so far for me, and Allaire's book isn't very explanatory on this point.<br><br>I'd like to know if it's possible in CF, or if this is a server-specified thing.<br>In that case, how does one set up a custom 404 page on Windows NT Server 4?<br><br>I appreciate your help<br>David
 
i think it's server specific<br>either you set it directly in the server admin (i know you can do this in ns server - don't know about other servers ...)<br>or you have to create a file named : .htaccess (nothing before the .) - then create the file you want to b displayed in case of 404 error (let's call it : 404.htm) - then add this line in the .htaccess file : ErrorDocument 404/name_of_your_site/name_of_the_folder_if_one/404.htm - the .htaccess has to b in the root directory - and it should b working <p> <br><a href=mailto:miss_lezard@bigfoot.com>miss_lezard@bigfoot.com</a><br><a href= > </a><br>
 
I've done this, and it works fine with .htm pages, but I still get the ugly CF 404 error otherwise.....<br><br>Let me know if you find a solution.<br><br>DM
 
configuring netscape server (well, the server you use !) works even for .cfm files - i've done that and it's fine :] <p> <br><a href=mailto:miss_lezard@bigfoot.com>miss_lezard@bigfoot.com</a><br><a href= > </a><br>
 
Just stopped back in to close this up. NT Server admin has a settings tab to specify your 404 page.

.htaccess is a UNIX-specific trick ... my Windows server automatically deleted (or hid, I'm not sure which) the .htaccess file every time I tried to put it on the server.

I know this question comes up a lot.
HTH you!
 
Oh, and one more thing. The custom 404 will apply to every directory on your server. You can't specify different 404 pages for different directories.
 
oh yes you can, at least if you're using netscape server as a web server. I don't know about other web servers, but they should provide a function to do so. (in ns server, it's when you define a (virtual or actual) directory, then you can specify as well : specifics security settings, specifics mappings, .... and specifics error pages !!!)
 
If you use IIS... and you want 404s to apply to CF pages as well... Do this:

1) Open IIS MMC panel
2) Right click your site and select Properties
3) click tab &quot;Home Directory&quot;
4) click Configuration
5) scroll down to .cfm and select edit
6) Check the box that says... &quot;check that file exists&quot;
7) Under Custom Errors select 404
8) Select Message Type URL
9) Put in /Error/404.cfm

No you can make a folder called Error in the root directory, and add the 404.cfm of your choice.

Please let me know if this helps you out at all.

:)


-- David McIntosh
 
OK...

How do you set up a 404 on a Unix Server that will habdle .cfm pages as well? I wrote the above regarding NT but now I have an UNIX box that needs custom 404 per domain.

Anyone that can offer advise?
-- David McIntosh
 
Still no one with an answer.... or is there no answerm other than a CF admin 404 for all cf errors.

That wont do on a shared hosted enviroment.

Any ideas?

I thought about making the custom error the CF admin goes to .. look at the domain refering it and then redirect to the appropriate domain error page.

Would that work?
-- David McIntosh
 
The problem with your suggestion of using the application.cfm for a 404 is that, since there is a 404, no page is being loaded. And therefore, application.cfm will not be loaded. If that makes sense. Since application.cfm prepends any .cfm file, since no .cfm is being accessed in the first place, application.cfm cannot be invoked.

In a shared hosted environment, it IS still possible to set specific 404 pages in each site/virtual directory. Or at least, it's possible using IIS.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top