Just these two:
RewriteEngine on
RewriteRule ^the-file\.js$ /the-file.php [L]
And yeah, the little line ender is a good idea for an exact match where you don't want to send the info from /the-file.php to requests for /the-file.js3. Thanks for pointing out the little technicality there Readie.
Just so you know what it does bsbarker:
^ = the beginning of a line.
the-file = the full path to the file
without the preceding / in the .htaccess file (IOW: /the-file in the .htacces won't match because if looks forward -> and you're already at /, but in the httpd.conf you'll need it.). If the file is in a directory, simply add the directory name before the file name EG if the file is at: http://www.example.com/js/main-script.js you would use: js/main-script\.js
\. = a literal dot, because in a regular expression . is 'anything except the end of a line' and that's not what we want to match here, you want it to be a literal dot, so the-file9js doesn't not serve the file too.
js = the file extension (obviously)
$ = the end of the matching pattern.
/the-file.php can be any file anywhere on your server.
[L] = LAST this tells the rewrite engine to stop processing and serve the info. A L flag should always be used unless you know you don't need it.
And that's concludes your lesson on mod_rewrite for the day.
Have fun with it. :)