http-status-code-404

How to fake 404 in IIS7

I would like to set /directory/default.aspx to return 404 even though file and folder exist. How is this possible to do in IIS7 settings? Update: I would like to do this in IIS Manager, not on code. ...

404 ErrorDocument Problem

I have .htaccess already configured: ErrorDocument 404 error.php But whenever I go to an invalid page, it should display the 404 page, but it just shows: "error.php" Just blank white, just the text of the php file only... The file and .htaccess does exist. Inside error.php: <?php $title = "Error 404 - Page Not Found"; incl...

How to get MVC action to return 404

I have an action that takes in a string that is used to retrieve some data. If this string results in no data being returned (maybe because it has been deleted), I want to return a 404 and display an error page. I currently just use return a special view that display a friendly error message specific to this action saying that the item...

How can I get NSURLResponse body?

Hi, I'm writing an application that connect with a server using NSURLConnection. In the delegate method didreceiveresponse:, if the status code is 404, I cancel the connection and I would like to show a message with a custom error that is generated in the server. The problem is that from response object, I only can get statuscode, he...

Tomcat reporting 404 error on all of newly deployed WAR files?

I deployed a WAR file into $TOMCAT_HOME/webapps by copying the file into the directory, just like I've done a thousand times before. Tomcat detects the WAR and inflates it. I can traverse the directory tree on my server at the command line (it's Fedora). But when I address the webapp within my client machine's browser, I get nothing b...

How does one suppress a 404 status code in a WordPress page?

I've got a WordPress site that includes pages pulled from a different database. The problem is that these other pages return a 404 status code. (The WordPress posts/pages are fine.) The 404'ed pages display fine, and I removed the "Page not Found" text from the title tag in WordPress. But Googlebot and W3C see the 404 header. So: wow d...

.htaccess cross browser

Hi, Im trying to load a custom error document for a 404 error using a .htaccess file on a linux server, the page gets the current page URL then redirects to another site (which is retrieved from a db) based on an id it retrieved from the URL. The current error documents are stored here: /error_docs/ - i dont have permission to upload...

custom 404 - would this work?

Is this custom 404 page supposed to work? It was created by another developer... Running IIS7 <%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%> <% strQString=lcase(Request.ServerVariables("QUERY_STRING")) If (Len(strQString)>4) Then strURL=Right(strQString,Len(strQString)-4) If (instr(lcase(strQString),"www")>1) then strURL = Repl...

PHP, MVC, 404 - How can I redirect to 404?

I'm trying to build my own MVC as a practice and learning experience. So far, this is what I have (index.php): <?php require "config.php"; $page = $_GET['page']; if( isset( $page ) ) { if( file_exists( MVCROOT . "/$page.php" ) ) { include "$page.php"; } else { header("HTTP/1.0 404 Not Found"); } } ?> My...

Awstats showing 404s for pages and objects I definitely don't have...

I have a HostGator site using Awstats and I've recently noticed the following 3 bizarre 404s: [address] [times] /images/wikimedia-button.png 1 /apple-touch-icon.png 1 /imgs/custom-space.gif 1 the first and third also carry referrers from within my site, but are 100% definitely absolutely n...

PHP Redirect Headers Best Practices

I'm creating a PHP CMS and have some system pages like a 404 page, a maintenance page, and an unauthorized access page. When Page A isn't found, the CMS will redirect to the 404 page; if the user doesn't have access to Page B, it will redirect to the unauthorized access page, etc. I'd like to use the proper status code in the header of...

Joomla error.php

I copied error.php from the system template to my template folder, and it works fine when I enter a bad page.... except if that page ends in .txt... then joomla does not use error.php... can I change this so it does? and it's not just .txt... it's any non standard web extension... zip.. ppt... ect ...

Wordpress 3 Broke My Theme? - Spurious 404 Errors

Ok so I think I'm going nuts. I've got 2 blogs running Wordpress 3. Both use the same theme. Nothing has been drastically modified in either one, but the one is displaying as it should and the other is missing various styles and functionality. I know the cause of the problem - a 404 error on the one site for two resources. These resourc...

Struts 2 404 error with . in the URL

I'm getting a tomcat 404 error in my application when I hit a url with a dot. Something like http://www.example.com/homePage.ac I've got a default action defined and it catches missing actions, but it doesn't seem to catch these type of URLs. I tried defining a page in web.xml, but my error page isn't a static page, it's another acti...

404s for asp.net mvc solution doesn't work in production

I used Shay Jacoby's solution to route 404s and 500s and it works great on my dev box: http://stackoverflow.com/questions/619895/how-can-i-properly-handle-404s-in-asp-net-mvc/ However, in production, it only routes 500 errors and 404s still get the default iis 404 messages. I think I'm missing something simple, any ideas? I deployed t...

How I'll let PHP to show the default error page of the server?

If the ID (ie user) does not exist I send header("Status: 404 Not Found"); to the browser but PHP sends rest of the page too. Then I made it to send nothing but then it showed a blank white page. I want it to show the default error page. How I'll let it to do it? ...

Where do I set Response.TrySkipIisCustomErrors?

I working on a custom 404 page and keep getting a 500 error from IIS7. After doing some research I found I need to set "Response.TrySkipIisCustomErrors=true;" Where do I set that value? Can it be set in anyway with php or within the web.config file? my 404 web.config code is: <customErrors mode="On"> <error statusCode="404" redire...

Can I raise Http404 in a Django template tag?

I have a Django application that provides template tag profile. The tag accepts a username as its argument. How should I treat the situation when there exists no User instance with the given username? Does it make sense to raise HTTP 404 inside a template tag? Or should I simply pass an empty dictionary to the template? ...

Django Admin Intermittently Returning 404 On Model Edit

We're using the Django Admin to maintain some data that's exported to a few of our sites. Sometimes when clicking through the standard changelist view to get a model edit form instead of being routed to the correct page we're getting the Django 404 page/template. It was happening somewhat sporatically, and we could for a while reproduce...

PHP: Can't change 404 status code, but there is no error from header()

I'm processing unavaliable pages in my custom PHP website. To do this I created a .htaccess file with this single line: ErrorDocument 404 /index.php At the beginning of index.php I placed this code: header($_SERVER['SERVER_PROTOCOL'].' 200 OK', true, 200); This works perfect in my WAMP environment. I'm checking http headers, and it...