这是一个mod_rewrite错误还是我错过了什么?

时间:2012-03-04 18:19:52

标签: regex mod-rewrite

我有一个简单的.htaccess文件

RewriteEngine on

RewriteRule ^[^-]*-(.*)$ http://example.com/$1 [R]
RewriteRule ^[(template)(internal)(stuff)(files)] - [L]

RewriteRule ^([^/\.]+)/([^/\.]+)/?$ index.php?category=$1&page=$2 [L]
RewriteRule ^([^/\.]+)/?$ index.php?page=$1 [L]
RewriteRule ^/$ index.php?page=news [L]

当我请求http://example.com/foo/bar时一切正常 - Apache2会重定向到http://example.com/index.php?category=foo&page=bar,但是当我请求http://example.com/aoo/barhttp://example.com/zoo/bar时(类别名称以a或z开头) )它没有被重定向 - 由一个错误关闭?

.htaccess测试员http://htaccess.madewithlove.be也做到了。

有人能搞清楚吗?

编辑: aoo / bar - 404; boo / bar - index.php; coo / bar - index.php; doo / bar - index.php; eoo / bar - 404; foo / bar - 404; goo / bar - index.php; hoo / bar - index.php; ioo / bar - 404; joo / bar - index.php; koo / bar - 404;厕所/酒吧 - 404; moo / bar - 404; noo / bar - 404; ooo / bar - index.php;便便/酒吧 - 404; qoo / bar - index.php; roo / bar,soo / bar,too / bar - 404; uoo / bar,voo / bar,woo / bar,xoo / bar,yoo / bar - index.php;动物园/酒吧 - 404

1 个答案:

答案 0 :(得分:1)

你的第二条规则是FUBAR。弄清楚你想要它做什么,然后再试一次。