In one of my sites, www.whatever.com I prepared .htaccess file with rewrite rules that permanently redirect [r=301,nc] whatever.com to whatever.com/whatever/whatever.htm and then replace .htm files with corresponding .php files without 301 redirection, so that php would be completely hidden from the visitors.
I am pretty sure I tested it and it was working fine a few months ago. When I tried it today, I saw it showing php files instead, and all the links are, therefore, broken.
Here is my .htaccess file:
RewriteEngine on
Options +FollowSymLinks
# www.whatever.com -> www\.whatever\.com/whatever/whatever\.htm
RewriteCond %{HTTP_HOST} ^www\.whatever\.com$
RewriteRule ^index\.html*$ http://whatever\.com/whatever/whatever\.htm [r=301,nc]
RewriteCond %{HTTP_HOST} ^www\.whatever\.com$
RewriteRule ^$ http://www.whatever.com/whatever/whatever\.htm[r=301,nc]
# all htm to php, html stays
RewriteRule ^(.*)whatever/(.*)\.htm$ $1whatever\.php/$2.php
I expect the first set of rules 301 redirect www.whatever.com into www.whatever.com/whatever/whatever.htm, and it does it when I remove the last rule.
The last rule should convert resulting www.whatever.com/whatever/whatever.htm into
www.whatever.com/whatever.php/whatever.php, but since there is no 301 redirect in the last rule the visitors should still see www.whatever.com/whatever/whatever.htm in the browser address line! The problem is that they see www.whatever.com/whatever.php/whatever.php instead.
The last rule works correctly by itself, however.
Again, I am pretty sure I tested it and it was working fine a few months ago.
What could be the problem?
Thank you very much for your help,
-needhelp