I have a PHP web app located on shared hosting. My goal is to modify .htaccess file from PHP code when the PHP page is running. I need that .htaccess to insert a couple of mod_rewrite lines into it.
The problem is that on Windows+Apache I can dinamically modify .htaccess file but the same code on Linux reports a problem when I try to access this file in any way (copy or fopen): "failed to open stream: Permission denied"
I have given .htaccess file 777 permissions - still no result. WHat prevents me from doing this? How can I develop a workaround?
P.S. My initial goal was to be able to add a new RewriteRule into .htaccess that maps a newly added category_id with new category_name. If it wasn't shared hosting, I would use something like RewriteMap (in main Apache config) and would be able to access the map file.
This is the first real limitation I've been unable to tackle with PHP+Apache, but I hope it's circuventable too.