Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/apache/9.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 分页的htaccess重写规则不起作用_Apache_.htaccess_Mod Rewrite_Pagination - Fatal编程技术网

Apache 分页的htaccess重写规则不起作用

Apache 分页的htaccess重写规则不起作用,apache,.htaccess,mod-rewrite,pagination,Apache,.htaccess,Mod Rewrite,Pagination,我的htaccess中有以下内容: Options +FollowSymLinks -Multiviews -Indexes DirectoryIndex index.php RewriteEngine On RewriteBase / # To externally redirect /dir/file.php to /dir/file RewriteCond %{THE_REQUEST} \s/+(?:index)?(.*?)\.php[\s?] [NC] RewriteRule ^

我的htaccess中有以下内容:

Options +FollowSymLinks -Multiviews -Indexes 
DirectoryIndex index.php

RewriteEngine On
RewriteBase /

# To externally redirect /dir/file.php to /dir/file
RewriteCond %{THE_REQUEST} \s/+(?:index)?(.*?)\.php[\s?] [NC]
RewriteRule ^ /%1 [R=301,L,NE]

# To internally forward /dir/file to /dir/file.php
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{DOCUMENT_ROOT}/$1\.php -f [NC]
RewriteRule ^(.+?)/?$ $1.php [L]
现在,我正在尝试添加一些分页规则,这些规则使我的htaccess文件保持如下状态:

Options +FollowSymLinks -Multiviews -Indexes 
DirectoryIndex index.php

RewriteEngine On
RewriteBase /

# To externally redirect /dir/file.php to /dir/file
RewriteCond %{THE_REQUEST} \s/+(?:index)?(.*?)\.php[\s?] [NC]
RewriteRule ^ /%1 [R=301,L,NE]

# To internally forward /dir/file to /dir/file.php
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{DOCUMENT_ROOT}/$1\.php -f [NC]
RewriteRule ^(.+?)/?$ $1.php [L]

RewriteRule ^beta/network/showcase/category/(.*)/page/(.*)$ beta/network/showcase.php?category=$1&page=$2 [L]
RewriteRule ^beta/network/showcase/category/(.*)$ beta/network/showcase.php?category=$1 [L]
RewriteRule ^beta/network/showcase/page/(.*)$ beta/network/showcase.php?page=$1 [L]
RewriteRule ^beta/network/showcase/([0-9]+)$ beta/network/showcase_single.php?id=$1 [L]
它们都可以工作,除非从这个:

RewriteRule ^beta/network/showcase/category/(.*)/page/(.*)$ beta/network/showcase.php?category=$1&page=$2 [L]
当找不到页面时引发404错误:

在此服务器上找不到请求的URL/beta/network/showcase/arts entertainment/page/2

为什么这一特定规则失败了


谢谢

问题已根据@anubhava的回复得到解决,我忽略了URL中的“/category/”。

您尝试的URL中没有/category/text:/beta/network/showcase/arts entertainment/page/2ohh!我完全忽略了这一点!成功了:很高兴知道成功了,干杯!