2
我已经成功地实现像URL基本的Facebook:mod_rewrite的()太多的内部重定向
http://example.com/(username)使用下面的mod_rewrite代码内部调用http://example.com/sites/(username) :
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !^/sites/
RewriteRule ^([^/]+)/?(.*)$ sites/$1/$2 [NC,L]
请注意(用户名)文件夹存在于网站文件夹内
上述工作非常好。但现在我想美化我的其他网址,如: http://example.com/(username)/Image/2/这应该在内部调用http://example.com/sites/(username)/index.php?type=image&id=2
要做到这一点,我添加在倒数第二行下面的代码:
RewriteRule ^([^/]+)/Image/(.*)$ /sites/$1/index.php?type=image&id=$2 [NC,L]
我希望在[L]最终会在这之后停止计算规则。但是从日志中可以看出它进入了一个无限循环并被截断。
有人能指出我在这里做错了吗?