本文介绍了不工作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的重写规则分页
发布评论