我想像这样添加htaccess的分页。所以我举了一些例子。 bottom有我的htaccess代码。所以如何解决这个问题。帮帮我这篇文章。感谢。
example.com/calendar/2014/page/2< - example.com/calendar/load.php?year=2014&page=2
example.com/calendar/2014/4/page/2< - example.com/calendar/load.php?year=2014&month=4&page=2
example.com/calendar/2014/4/27/page/2< - example.com/calendar/load.php?year=2014&month=4&date=27&page=2
这里是我的htaccess代码
/calendar/.htaccess
Options +FollowSymLinks
RewriteEngine On
RewriteBase /calendar/
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^ http://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,NE,L]
RewriteRule ^([0-9]+)/?$ load.php?year=$1 [L,QSA]
RewriteRule ^([0-9]+)/([0-9]+)/?$ load.php?year=$1&month=$2 [L,QSA]
RewriteRule ^([0-9]+)/([0-9]+)/([0-9]+)/?$ load.php?year=$1&month=$2&date=$3 [L,QSA]
答案 0 :(得分:1)
您可以使用:
Options +FollowSymLinks
RewriteEngine On
RewriteBase /calendar/
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^ http://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,NE,L]
RewriteRule ^([0-9]+)/?$ load.php?year=$1 [L,QSA]
RewriteRule ^([0-9]+)/(page)/([0-9]+)/?$ load.php?year=$1&p=$3 [L,QSA]
RewriteRule ^([0-9]+)/([0-9]+)/?$ load.php?year=$1&month=$2 [L,QSA]
RewriteRule ^([0-9]+)/([0-9]+)/(page)/([0-9]+)/?$ load.php?year=$1&month=$2&p=$4 [L,QSA]
RewriteRule ^([0-9]+)/([0-9]+)/([0-9]+)/?$ load.php?year=$1&month=$2&date=$3 [L,QSA]
RewriteRule ^([0-9]+)/([0-9]+)/([0-9]+)/(page)/([0-9]+)/?$ load.php?year=$1&month=$2&date=$3&p=$5 [L,QSA]