不工作htaccess的重写规则分页分页、重写、规则、工作

2023-09-02 01:01:57 作者:给力╃man

我在我的htaccess如下:

I have the following in my 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文件分页规则如下:

Now, I am trying to add some pagination rules which left my htaccess file as follows:

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]

他们所有的工作,除非从这个:

They all work unless from this one:

RewriteRule ^beta/network/showcase/category/(.*)/page/(.*)$ beta/network/showcase.php?category=$1&page=$2 [L]

将抛出一个404错误,因为找不到网页:

Which throws a 404 error as page not found:

所请求的网址/测试/网络/展​​示/艺术娱乐/页/ 2在此服务器上找到。

The requested URL /beta/network/showcase/arts-entertainment/page/2 was not found on this server.

这是为什么特定规则失败?

Why is that particular rule failing?

谢谢!

推荐答案

发行每@anubhava反应是解决了,我忽略了URL中的/分类/'。

Issue was resolved per @anubhava response, I overlooked the '/category/' in the URL.