【发布时间】:2016-01-08 21:13:00
【问题描述】:
我正在构建一个页面结构非常简单的博客,由articles.php、article.php 和categories.php 组成,我想整理每个页面的 url 路径,但是我遇到了麻烦了解模组的工作原理。
目前我的articles 页面是主页,使用DirectoryIndex 完成,但我的网址看起来像:
http://testblog.local.co.uk/?cat=all¤tpage=3
我希望它在哪里:
http://testblog.local.co.uk/all/3
到目前为止,我的 htaccess 代码如下所示:
DirectoryIndex articles.php
RewriteEngine On
RewriteRule ^/?([a-zA-Z_]+)/([0-9]+)$ articles.php?cat=$1¤tpage=$2 [L]
这对 url 没有任何作用,也不会正确显示页面。我浏览了无数在线“初学者指南”,但仍然无法解决。有人可以帮忙吗?
【问题讨论】:
标签: apache .htaccess mod-rewrite url-rewriting friendly-url