Question:
Server not responding with 404 even if incorrect url is given... Index.php is sent instead?
2011-11-02 14:40:39 UTC
I have a website with links to PDF files, when I click those links the server just sends me to a wrong direction, with no errors.
If I supply a wrong URL the server won't show me a 404 error, it will still send me to the same wrong direction.
it looks like it's the index page, but in the wrong directory, look it yourself: http://laclee.org

if I go to an incorrect url http://laclee.org/blahblah.php
the same index.php will load, but broken.

and if I go to a correct url, that links to a PDF file that IS there, it will still show the same broken index page, e.g. http://www.laclee.org/Reglamento/estatutogeneralclee.pdf

I checked to see if the problem was the .htaccess or leftover pieces of an old Wordpress installation, but nothing works.

thanks in advance
Three answers:
2011-11-02 15:02:14 UTC
Ahh, I've just fixed the same problem with my website. The problem is within your .htaccess url Rewrites. Without seeing what you've written, it's kinda hard to tell you where you went wrong or wasn't specific enough in your Rewrite.



It looks like you're using php so in your case adding to .htaccess file, something like:



ServerSignature Off

Options -Indexes



RewriteEngine on

RewriteBase /



RewriteRule ^(.*)\.php/(.*) /404\.php [R=301,L]



Should do the trick, this rewrite rule basic says redirect anything with php/ to 404.php and since you dont have a file named 404.php (as far as i know) it will generate a 404 error.



As far as the last link to the pdf file is concerned, it looks like it's being redirected, so you might want to review your rewrite.
cutter
2016-12-15 23:22:00 UTC
howdy adult males, They’re no longer as stressful because of the fact the infamous “blue exhibit screen of loss of life,” yet 404 errors can nevertheless wreck a information superhighway surfer’s day. I don’t come for the period of as a lot of ‘em as I used to, yet I nevertheless concept it may desire to be interesting to assessment the place the call got here from. I asked the community if there grow to be some style of value to the quantity “404,” and have been given a slew of great responses. maximum human beings defined that the quantity 404 is a sort of code that exhibits, to those that situation to assessment the code, what precisely the subject could desire to be. contained relating to the 404, the 1st “4? exhibits a customer errors. As a community member places it, “the server is asserting which you’ve achieved something incorrect, which includes misspell the URL or request a internet site that's now no longer there.” the middle “0? exhibits a well-known syntax errors. in accordance to 404 study Labs, a internet site used via countless responders, this could point out a spelling mistake. The final “4? exhibits the particular style of errors “in the ‘40x’ team.” As one source places it, the 404 status message is used “while the server does no longer desire to bare precisely why the request has been refused, or while no different reaction is optimal.” long tale short, there's a ability to the insanity. A responder who works interior the IT field writes that there are “standards for each little thing, which incorporates errors messages.” case in point, jointly as a 4xx errors exhibits a customer errors, a 5xx message exhibits a server errors, a 3xx message exhibits a redirect, etc. So, there you pass, the secret of the 404 has been solved attributable to you adult males. possibly now I gained’t be as aggravated once I come for the period of those errors. yet in all probability no longer. thank you for analyzing,
Unca Alby
2011-11-02 15:00:21 UTC
Check the configuration files of your web server. E.g., for Apache on Linux, /etc/httpd/httpd.conf or /etc/httpd.conf.


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...