The problem I'm having is that the code you posted works just fine.... depending on what you're trying to do. Which is why I asked you to clarify, "In what way is it not working?" It's not helpful enough to just say that you "type a URL." Nor is it helpful enough to say, "I want it to be without." You need to show us the specific URL you're typing, and you need to tell us the specific behavior you expect. Are you hoping for an external redirect? That is, the server sends back a redirect response and the browser re-fetches from that new location. This tends to have the effect of changing the URL in the address bar. Or are you hoping for an internal rewrite? That is, you type in an extensionless URL, and the server maps that extensionless path to a real file on your server. This lets you leave .php off the URL but still get the content of the .php page.