【发布时间】:2011-04-20 22:54:22
【问题描述】:
我设置了以下重写规则:
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/
如果“api”以外的任何内容作为第二段发送,它将重定向到index.php/other/whatever。
我的理解是否存在某种缺陷?我认为它会在列表中出现,并且带有 L 标志,一旦它碰到什么东西就会停止执行。还是我的语法错误?
干杯
【问题讨论】:
标签: php apache .htaccess mod-rewrite apache2