I've the next .htaccess file on my small webroot:

DirectoryIndex index.htm index.html index.php AddType application/x-httpd-php .htm .html
RewriteEngine On
RewriteBase /

RewriteCond %{ENV:REDIRECT_STATUS} 200 RewriteRule .* - [L]

RewriteCond $1 !\.(gif|jpe?g|png|ico|css|js|pdf|mp3|flv|swf)$
RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^/(.+)\.htm$ /$1.php [nc,L,QSA]

The objective of the Rewrite rule would be to change any request a webpage having a .htm extension to some request for the similar filename having a .php extension (unless of course the file with .htm extension really is available). This rule appears to "work" meaning when I request for any page having a .htm extension, I recieve the PHP content. This is exactly what I would like, but simultaneously HTTP header inspector tools are convinced that the web site is giving a 404 response. What's strange is the fact that my tools are convinced that in your body of the identical RESPONSE, the server returns the right HTML produced through the PHP code. That appears just like a contradiction: page not found, but here's this content you desired anyway??

Basically pressure the server to transmit a 200 code ([R=200]), I recieve an "Internal server error" response, and when I pressure it to transmit a 301 code ([R=301]), as a result the browser makes 2 HTTP demands rather than 1, and also the second one eventually ends up as being a 404 anyway (however i get the preferred HTML within the response body!). I am confused!!!

Solved. The Content management systems software was delivering a 404 header because of a mistake within the page code. After I fixed that, I ended obtaining a 404 code within the response header.