如何使用mod_rewrite伪造路径? 基本上如何使用mod_rewrite在特定的url路径上提供平面文件?

It's been awhile since I've used mod_rewrite so I am hoping somebody can shed some light on this quickly.

Basically, I have a flat dynamic PHP file, call it myForm.php. I need to serve this file whenever a request is made on the domain at the path h.t.t.tp://mydomain.com/mylong/uri/contact/path. If a user goes to that location I need my apache server to serve the myForm.php file, and this of course should be oblivious to the user. They would still see /mylong/uri/contact/path as their location address, but the file being served is from the webroot folder or some other location and called myForm.php.

This is easily possible using mod_rewrite correct?

Something like:

RewriteEngine  on
RewriteRule    ^/mylong/uri/contact/path$  /myForm.php [PT]

Does that work? Taken from: http://httpd.apache.org/docs/trunk/rewrite/remapping.html

Thanks in advance to anyone who can confirm and provide a great answer!

Remove leading slash from RewriteRule:

RewriteEngine  on
RewriteRule ^mylong/uri/contact/path/?$ /myForm.php [L,NC]

.htaccess is per directory directive and Apache strips the current directory path (thus leading slash) from RewriteRule URI pattern.