Can I make a dynamic .htaccess file?

后端 未结 3 2117
自闭症患者
自闭症患者 2020-12-30 17:14

Can I make my .htaccess be generated with php?
I would like to use php to dynamicly create my htaccess file from information from the database.
It would save me the

3条回答
  •  醉酒成梦
    2020-12-30 18:00

    Can you? Sure. You can create files in the filesystem with PHP so long as you have permissions.

    Should you? Well, if you are only using PHP in "command-line" mode, I suppose it's as good as another scripting language. If you are doing so from a website, I would say this is a bad idea for security reasons. Another technology might be more appropriate (if you originally had XML, then XSLT would come to mind, but you're using mysql, so you'll need some other kind of script).

提交回复
热议问题