[英].htaccess URL rewriting not working on pagination?
我有以下网址localhost/test/index.php?page=1
,到目前为止,我希望它是'index.php / page / 1':
RewriteEngine On
RewriteRule ^page/([0-9]+)/?$ index.php?page=$1 [NC,L]
但这是行不通的。任何建议我做错了什么?
试试这个
RewriteRule ^page/([^/]*)$ index.php/?page=$1 [L]
如果您将其设置为正确,则类似http://localhost/test/page/1
URL应该可以使用
试试这个
RewriteEngine on
RewriteRule ^(.*)/page/([0-9]+)$ /index.php?page=$2 [NC,L]
该网址将是
localhost/test/index.php/page/123
如果您想要的网址看起来像
localhost/test/index.php/page/123/
改变你的规则到这一条
RewriteEngine on
RewriteRule ^(.*)/page/([0-9]+)/$ /index.php?page=$2 [NC,L]
RewriteRule ^index.php\/page\/(.*?)\/?$ index.php?page=$1 [NC]
上面的代码应该可以解决您的问题。 但是您可能想阅读mod_url_rewrite
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.