RewriteRule 500错误问题
我设置了以下重写规则:
RewriteEngine On
RewriteRule ^api/([A-Za-z0-9-]+)$ index.php/api/$1 [NC,L]
RewriteRule ^([A-Za-z0-9-]+)$ index.php/other/$1 [NC,L]
不幸的是,这些规则导致我的服务器抛出 500 错误。单独来看,它们都工作得很好。
我的意图是,如果请求是 http://somesite.com/api/whatever/
,第一条规则将被触发,重定向到 index.php/api/whatever/
code>
如果除“api”之外的任何内容作为第二段发送,它将重定向到 index.php/other/whatever
。
我的理解有什么缺陷吗?我认为它会出现在列表中,并且带有 L 标志,一旦遇到某些东西就会停止执行。或者我的语法错误?
干杯
I have the following Rewrite Rules set up:
RewriteEngine On
RewriteRule ^api/([A-Za-z0-9-]+)$ index.php/api/$1 [NC,L]
RewriteRule ^([A-Za-z0-9-]+)$ index.php/other/$1 [NC,L]
Unfortunately these cause my server to throw a 500 error. Taken individually, they both work fine though.
My intention is that if the request is http://somesite.com/api/whatever/
, the first rule will get triggered, redirecting to index.php/api/whatever/
If anything other than "api" gets sent as the second segment though, it will redirect to index.php/other/whatever
.
Is my understanding flawed somehow? I thought that it would go down the list, and with the L flag, would stop executing once it hit something. Or is my syntax wrong?
Cheers
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
/var/log/httpd/error_log
(或系统上的等效路径)。[NC]
标志使[A-Za-z]
变得多余尝试:
或者也许
/var/log/httpd/error_log
(or the equivalent path on your system.)[NC]
flag makes[A-Za-z]
redundantTry:
Or perhaps
我认为您需要
QSA
标志 ,尝试这样:I think you need
QSA
flag, try like that :