404 Error Correction Script
Contents |
Windows PPTP Clients with Cisco VPN Routers Beginners Guide To Linux (My new Web site!) On the htaccess and XBitHack page we show you how to set up 404 message examples a professional looking 404 (page not found) error page that matches your site's
404 Error Message Text
appearance so that it gets displayed instead of the generic 404 error page generated by most Web servers. What if 404 error page template the reason visitors were getting this page was because someone else has a bad link to your Web site or page (a misspelled URL or a link to a page that you have
Error 404 Text Message Prank
removed)? Wouldn't it be nice to find out which referring pages have bad links to your site or pages? That's what this CGI script does. When someone encounters a 404 error on your site it will automatically send you an e-mail with the specifics (URL of the offending page, client info, etc.) so that you can contact the Webmaster of the referring site to have the 404 error page not found link corrected. If you're not familier with how to use CGI scripts, our How To Use Your CGI-BIN page will show you how to do that. You'll need to create an error HTML page and set up a .htaccess file to call the page in the event of a 404 error, but we show you how to do that on the htaccess and XBitHack page. Once that's done, all you have to do is set up this CGI script and add an SSI directive tag to the error HTML page to call the script. Note: This script was written for UNIX/Linux servers. If you know how to modify CGI scripts to work on Windows servers you should be able to get it work with IIS. See the CGI On Windows IIS page for some help with this. However, you will also need to know how to specify a non-generic 404 page in IIS. Consult the IIS documentation for this. Once everything is set up, each time the error HTML page is called by the .htaccess file and displayed, the script gets executed via the SSI directive. The script checks to see if the referral information is bla
accidentally includes punctuation (such as periods, commas, parentheses, brackets, and so on) in the URL. For instance, one popular forum
404 Error Fix
has a posting which consists of something like the following: blah blah
How To Create 404 Error Page In Html
(which I found at this site: http://www.bobulous.org.uk/misc/Replay-Gain.html) blah blah The problem is, because the forum software doesn't 404 error page html code require the user to markup where the URL starts and ends, it has to guess for itself. And it's guessing wrongly that the end-parenthesis symbol ')' is part of http://www.parkansky.com/tutorials/404alert.htm the URL. Users who clicked on incorrect links generated by such clumsy software were being taken to a drab "Error 404, File Not Found" page which told them that the address was invalid. And there's a good chance most users simply clicked "Back" or closed the tab and gave up, possibly cursing my site for the problem. The http://www.bobulous.org.uk/coding/php-404-handler.html options The number of such sites that were generating incorrect links seemed to be growing, so I wanted to help users to get to the page they were hoping for even if the link they'd clicked was slightly incorrect. One solution, which I quickly dismissed, was to configure Apache to redirect these unlucky users to the correct page. The problem with this method is that a redirect would generate a 301 "Moved permanently" HTTP status code, which suggests that the page used to be at the incorrect URL. Which is wrong, because the URL is simply incorrect, so a 404 "Not found" code ought to be generated. You could also use Apache's rewrite module to simply show the correct page to the user, but that's even worse, because then it looks like you've got multiple pages with the same content, which often causes search engines to penalise all of those pages. A far better solution is to generate a 404 page that tries to deduce, from the user's invalid request, which actual
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us http://stackoverflow.com/questions/5760538/ajax-call-to-php-script-returns-404-error Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Ajax call to php script returns 404 error 404 error up vote 9 down vote favorite 6 I'm a WordPress designer, I developed a contact form for one of my themes that's validated via jQuery. Please check the code below, then read the notes beneath. $('.submitemail') .click(function() { //VALIDATION CODE GOES HERE if ( /*VALIDATED SUCCESSFULLY*/ ) { $.ajax({ type: 'POST', url: templatePath+'/lib/scripts/sendEmail.php', data: 'visitorname=' + visitorname + '&visitoremail=' + visitoremail + '&visitormessage=' + visitormessage, success: function(contactResults) 404 error page { //SUCCESS CODE } }); } }); Notes: sendEmail.php is a correct script that sends email using PHPmailer class. templatePath variable has the value of the full template path which looks like this: http://somedomain.com/wp-content/themes/themename The jQuery code above is located in lib/scripts/jfunctions.js (same directory of the php script) The whole process (ajax and php) works perfectly as expected in many servers, (tested in two servers by me and other servers by my theme users). The Problem: In SOME servers, the success handler is not triggered while the ajax call to sendEmail.php is actually passed successfully and the php script is processed and email is sent. When I check with firebug to see why the success handler is not triggered, firebug shows "not found 404 error", It's like a false alarm. Possible causes: I think some servers is configured to block such ajax calls. What might be the cause for this weird issue? How to fix it? Thanks in advance. @nowk: sendEmail.php code is: ' . $themeName_option