Apache:帮助转换 .htaccess
我正在尝试将以下 .htaccess 重写规则转换为适当的 NGINX 格式。
# Redirect /signup/PLANNAME or /signup/PLANNAME/ --> /signup/index.php?account_type=PLANNAME
RewriteEngine on
RewriteRule ^signup/([A-Za-z]+)/?$ /signup/index.php?account_type=$1 [NC,L]
我尝试使用以下 NGINX 规则,但它不起作用。
rewrite ^signup/([A-Za-z]+)/?$ /signup/index.php?account_type=$1 last;
知道我做错了什么才能使 NGINX 正常工作吗?查看官方文档并没有多大帮助,因为该文档不是很详尽。
I'm trying to convert the following .htaccess rewrite rule to the appropriate NGINX format.
# Redirect /signup/PLANNAME or /signup/PLANNAME/ --> /signup/index.php?account_type=PLANNAME
RewriteEngine on
RewriteRule ^signup/([A-Za-z]+)/?$ /signup/index.php?account_type=$1 [NC,L]
I tried using the following NGINX rule, but it's not working.
rewrite ^signup/([A-Za-z]+)/?$ /signup/index.php?account_type=$1 last;
Any idea what I'm doing wrong to make this work with NGINX? Looking at the official documentation isn't very helpful since the documentation is not very through.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
由于您不在 .htaccess 文件内,因此必须使用绝对路径。像这样:
As you're not within a .htaccess file, you have to use absolute paths. As such:
我发现了问题,我缺少开头的正斜杠(/)。
回答:
I found the problem, I was missing the forward slash (/) at the beginning.
Answer: