【发布时间】:2015-06-22 21:31:57
【问题描述】:
是否可以根据 php 变量使用重写规则? 例如,我有 10 个网站,有 10 个域。每个网站都有一个“config.php”。在这个文件中,有一个名为 $city 的变量。
我可以用这种风格重写网址吗?
伪代码:
if ($city == 'berlin') {
page.php = page-berlin.php
}
【问题讨论】:
-
您可能对“重写”的含义有错误的认识。从这里开始:stackoverflow.com/a/20563773/476
-
感谢您的评论。当重写是我的问题的错误解决方案时,我应该使用什么来动态“重命名”文件?例如 xyz.tld/page1.php 到 xyz.tld/page1-berlin.php
标签: php html .htaccess mod-rewrite