Need a php function that will be invoked on our freebsd server by our shopping cart program to:
Create an ascii text file in the website root directory,
Write a sample 3 lines of text to the file, (we will replace the sample text with our own mod_rewrite directives),
Create (and overwrite) a copy of the existing .htaccess file in the root directory for the website, (.[url removed, login to view]), (ownership and security to be the same for the copy as is .htaccess)
Rename the new file as .htaccess, overwriting the existing .htaccess file.
Final ownership and permissions for the new .htaccess must be as they were in the original file now overwritten, (user & group).
If there are security-safe php5.x and/or apache2 configurations required for your code to work properly you must define them for our ISP.