不工作htaccess的重写规则分页

编程入门 行业动态 更新时间:2024-10-24 16:22:24
本文介绍了不工作htaccess的重写规则分页的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我在我的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.

更多推荐

不工作htaccess的重写规则分页

本文发布于:2023-11-02 08:26:50,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1551891.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:分页   重写   规则   工作   htaccess

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!