2012-12-05 25 views
1

我使用mod_rewrite将请求重定向到PHP文件斜线:重定向用或不用mod_rewrite的

RewriteRule gallery$ mod.php?m=gallery 

一切正常,当我打电话的URL格式为:http://localhost/project/gallery但是当我打电话http://localhost/project/gallery/我得到该页面没有fount错误。

我该怎么做才能解决这个问题?我应该输入一个与/重复的行吗?

回答

2

您的规则应该是这样的:

RewriteRule gallery/?$ mod.php?m=gallery [L,QSA,NC] 
+0

谢谢你,有没有新手的文档或教程了解'[L,QSA,NC]'什么意思呢? – MajAfy

+0

当然可以看到这个官方文档:http://httpd.apache.org/docs/2.0/mod/mod_rewrite.html#rewriteflags – anubhava