Mod_rewrite and urls that don't end with .php

Posted by Kevin Laity on Pro Webmasters See other posts from Pro Webmasters or by Kevin Laity
Published on 2011-02-18T21:31:52Z Indexed on 2011/11/19 10:16 UTC
Read the original article Hit count: 333

Filed under:
|

I'm trying to use Mod_rewrite to hide the .php extensions of my pages.

However, it refuses to do any rewriting unless the input url ends with .php, which makes that impossible. I can confirm that rewriting works fine as long as the url has .php at the end.

RewriteRule a\.php b\.php

Works, while

RewriteRule a\.html b\.html

does not.

How can I turn off this behavior and allow it to rewrite all urls? I'm on a shared host so whatever I do has to be done from a .htaccess file.

Update:

There seems to be some confusion about what I'm asking here. The question is not about how to write the rule, the question is about server configuration. The rule I'm using is fine, I can test that locally. But the server I'm working with is somehow configured so that mod_rewrite doesn't attempt to rewrite anything that doesn't end with .php

© Pro Webmasters or respective owner

Related posts about php

Related posts about mod-rewrite