lucy24 - 6:45 am on Jan 23, 2013 (gmt 0)
user/account.php doesn't exist as an actual file on the server.
That's fine. mod_rewrite doesn't care if a requested file really exists or not, unless you specifically ask it to check (the -f and -d flags).
I couldn't get rewrites working with site.com/user/account unless I appended a file extension
Uh-oh, there's something wrong here. Are there any other rules you haven't told us about?
htaccess cannot change a URL, it can only act on a URL request after a link has been clicked.
When you're a human browsing the web, it often looks as if an URL has been changed: you type in one thing, and the next thing you know, your browser's address bar says something different. But this is because your browser, acting on your behalf-- hence the term "User Agent"-- has received an instruction to ask for a different URL. And it quietly puts in this second request without asking your permission. (It has also asked for a zillion stylesheets and images without making you type in each name separately. Your browser does not get paid enough.)
When you are running your own site you can see it in action by looking at the logs. Request for such-and-such gets a 301 response, immediately followed by a request for something else from the same person. Between those two log lines, the browser has gone out into the Internet and entered your site all over again as if it had never been there before. (Well, presumably it knows where to look and doesn't have to hunt down the DNS all over again. But that's down to your browser.) You might even see a 301 immediately followed by a request for the same file. That's the with/without www. redirect in action.
Rewrites on the other hand don't show up in logs at all, and the browser doesn't know it's being rewritten. Your only clue is that the filesize might be different from the size of the file your visitor originally asked for (assuming it's something that really does exist). If someone asks for a 75K jpg and logs say they were given 2K, that's your anti-hotlinking routine at work ;) And if someone asks for something that doesn't exist, and logs show a 200 response with some appropriate filesize, that's your rewrite doing its thing.
:: memo to self: add foregoing to boilerplate somewhere ::
Beware that unescaped slashes are NOT a valid character within query string parameters. That may cause you some trouble.
Urk! Isn't there a question about that, just a few posts further down this forum? If you do have a slash, does something break outright or are you just left with an unhappy php page plotting revenge?