Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/apache/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Apache 分页模块重写_Apache_.htaccess_Mod Rewrite - Fatal编程技术网

Apache 分页模块重写

Apache 分页模块重写,apache,.htaccess,mod-rewrite,Apache,.htaccess,Mod Rewrite,我有一个页面已经是SEO友好的使用mod_重写。问题是,现在我需要在这里添加分页。我无法重写分页部分 顺便说一句,以下所有页面都由一个文件生成:list.php 以下是几页: domain.com/list/ - this page loads different data when there is no slug found domain.com/list/movies/ - this page loads specific data since there is slug found 现在

我有一个页面已经是SEO友好的使用mod_重写。问题是,现在我需要在这里添加分页。我无法重写分页部分

顺便说一句,以下所有页面都由一个文件生成:list.php

以下是几页:

domain.com/list/ - this page loads different data when there is no slug found domain.com/list/movies/ - this page loads specific data since there is slug found 现在我需要实现以下URL:

domain.com/list.php?slug=movies&page=2
致:


非常感谢您的帮助。

您可以使用以下工具

RewriteEngine on
RewriteRule ^list/(.+)/page-([0-9]+)\.html$ /list.php?slug=$1&page=$2 [L]

我试过了,但在这里它不起作用!非常感谢。它不工作真的不是一个正确的问题陈述。你能更具体地谈谈你所面临的问题吗?您正在尝试什么url,apache的错误响应到底是什么?当然。我检测slug来显示数据,当我使用这样的规则时,它返回的GET值是这样的:entertainment/page-2.html,而它应该是这样的:entertainment/对不起,我没有理解你。但当我转到/list/foobar/page-number.html时,我的服务器会在内部将其映射到/list.php?slug=foobar&page=number。我已经在我的服务器上测试了两次这个规则。它通常会测试,但不知道为什么它在这个分页部分表现得很奇怪!我应该共享整个.htaccess代码吗?
domain.com/list/movies/page-2.html
RewriteEngine on
RewriteRule ^list/(.+)/page-([0-9]+)\.html$ /list.php?slug=$1&page=$2 [L]