Is it possible to create my .htaccess using php?I would like to use php to dynamically create my htaccess file from information from the database.This will save me from having to create a new .htaccess file when I change a bit of my code.
You can read and write files with file system functions , for example:
$data = <<<EOF RewriteEngine on RewriteRule … EOF; file_put_contents('.htaccess', $data);
But it would be more flexible if you used one static rule that redirects requests to your PHP file and then does the rest.
? . PHP, .
? , PHP , , , . -, , . ( XML, XSLT , mysql, script).
.htaccess PHP, script, - . ? - , , - , . , , ?
What exactly are you trying to update?
Source: https://habr.com/ru/post/1767045/More articles:.htpasswd in coding - codeigniterChanging the command line arguments so that they cannot be seen in the outputs of ps - cUnit test in VS2010 - c ++Why are my ServiceConnection methods never executed? - androidRemote Programming IIS 6 and later - c #Есть ли альтернатива JXTA для фреймворков Java P2P? - javacannot combine a union of all kinds - sqlCan I center the jQuery UI dialog for a div? - jqueryMy query filtering does not work the way I want - sqlJQuery Roundabout plugin does not scale text in Opera - jqueryAll Articles