【发布时间】:2020-10-07 12:25:37
【问题描述】:
使用 apache 我使用文件 config.php 重写基于域的文件 config.js,config.js 包含由 RewriteRule 指令替换的占位符,这是 .htaccess 文件:
<IfModule mod_rewrite.c>
RewriteBase /foo
RewriteEngine On
RewriteRule config.js config.php [L,QSA]
</IfModule>
当我进入 URL production.com/foo/config.js 我看到一些值,而不是进入 develop.com/foo/config.js 我看到其他值,定义在 config.php 中
现在我需要迁移到 nginx,但我不明白如何复制 apache 规则,我试过了:
location /foo {
alias /src/www/foo;
index index.html;
rewrite config.js config.php break;
}
但是有内部服务器错误
谢谢
【问题讨论】:
-
抱歉,我写的是
last而不是break,但没有在配置代码块中更改它。更新了答案。
标签: nginx