0
我有一个.htaccess文件包含这个: RewriteRule ^page/(.*[^/])/?$ index.php?page=$1
基本上需要page/1/
到index.php?page=1
,它的工作原理。但我怎么能强迫index.php?page=1
在浏览器中显示为page/1/
?.htaccess固定链接
我有一个.htaccess文件包含这个: RewriteRule ^page/(.*[^/])/?$ index.php?page=$1
基本上需要page/1/
到index.php?page=1
,它的工作原理。但我怎么能强迫index.php?page=1
在浏览器中显示为page/1/
?.htaccess固定链接
您只需使用L标志。像这样:
RewriteRule ^page/(.*[^/])/?$ index.php?page=$1 [L,NC]
添加了NC标志以使正则表达式比较不区分大小写。
例如,所请求的URL http://example.com/page/1/
始终显示在浏览器的地址栏中,不会被替换URL:http://example.com/index.php?page=1
替代。