3

My 404 .htaccess works very well when I put a wrong extension at it in place of .php.

Unfortunately the 404 does not work when I put a wrong name with .php.

This is my .htaccess code:

<Files ~ "^.(htaccess|htpasswd)$">
deny from all
</Files>
Options -Indexes
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\..* [NC]
RewriteRule ^(.*) http://www.%{HTTP_HOST}/$1 [R=301]

ErrorDocument 404 /404/notfound.html
order deny,allow
5
  • What do you see when you specify wrong url, that ends with .php?
    – zerkms
    Aug 9 '11 at 23:07
  • let me show u my links [link]s376762308.websitehome.co.uk/contactus.php this does not appear 404 file it is fine when eextenstion wrong [link]s376762308.websitehome.co.uk/contactus.html
    – maanu
    Aug 9 '11 at 23:14
  • Have you contacted to the support?
    – zerkms
    Aug 9 '11 at 23:21
  • @zerkms you mean with service provider
    – maanu
    Aug 9 '11 at 23:25
  • 4
    yep. Your .htaccess looks fine and works well for me. Seems like it is some specific webserver option specified on that server
    – zerkms
    Aug 9 '11 at 23:30
2

This is probably because all PHP requests are being sent to the PHP interpreter. I have seen this before on certain setups, normally with optimized PHP, specially configured FastCGI, etc.

What hosting platform are you on? Is it a linux host? You mention Apache. Do you have control over the server? What does php.ini look like?

Are you still having this issue? The links in your post look the same to me.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.