I have a PHP web application hosted on a shared hosting . My goal is to modify the .htaccess file from the PHP code when starting the PHP page. I need this .htaccess to insert a couple of mod_rewrite lines into it.
The problem is that on Windows + Apache I can change the .htaccess file dynamically but the same code on Linux reports a problem when I try to access this file in any (copy or fopen):
"failed to open stream: Permission denied"
I gave the .htaccess file 777 permissions - there is still no result. What is stopping me from doing this? How can I develop a workaround?
PS My initial goal was to add a new RewriteRule to .htaccess, which displays the added category_id category with a new category name.
If this were not shared hosting, I would use something like RewriteMap (in the main Apache config) and could access the map file.
This is the first real limitation that I could not handle with PHP + Apache, but I hope this is also possible.
AlexA source
share