PHP - 我可以将规则从另一个文件或数据库导入.htaccess文件吗?

I have multiple domains running on the same code and the same directory, sharing the same .htaccess file also. I want to make those domains use separate redirect rules either from db or another file. So my question is that can I import rules from another file or DB into .htaccess file? Is it possible or not, if yes then how? Prior thanks to any help...

The only way is to write the information from the database to the .htaccess file. It means you have to regenerate it yourself. You can read more about the format here: https://httpd.apache.org/docs/2.4/howto/htaccess.html

You can do a similar thing using the HTTP based authentication: https://developer.mozilla.org/en-US/docs/Web/HTTP/Authentication and store this information in cookies (and session). A very simple example can be found in this gist: https://gist.github.com/rchrd2/c94eb4701da57ce9a0ad4d2b00794131