2013-03-30 80 views
0

我有一个.htaccess文件包含这个: RewriteRule ^page/(.*[^/])/?$ index.php?page=$1基本上需要page/1/index.php?page=1,它的工作原理。但我怎么能强迫index.php?page=1在浏览器中显示为page/1/.htaccess固定链接

回答

0

您只需使用L标志。像这样:

RewriteRule ^page/(.*[^/])/?$ index.php?page=$1 [L,NC] 

添加了NC标志以使正则表达式比较不区分大小写。

例如,所请求的URL http://example.com/page/1/始终显示在浏览器的地址栏中,不会被替换URL:http://example.com/index.php?page=1替代。