1

With my current code I can convert the URL:

www.midomain.com/all.php?id=3

In this URL (I can perfectly get the 'id' with php):

www.midomain.com/all/3/

But how do I convert the URL:

www.midomain.com/all.php?id=3&page=2

In this URL?:

www.midomain.com/all/3/2/
or:
www.midomain.com/all/3/page-2/

This is my actual code:

Options +FollowSymLinks
RewriteEngine on

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^([^/]+)/$ $1.php

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !(\.[a-zA-Z0-9]{1,5}|/)$
RewriteRule (.*)$ /$1/ [R=301,L]

RewriteRule ^all/([^/\.]+)/?$ all.php?id=$1 [L]
4

1 回答 1

0

扩展正则表达式以匹配您所追求的 url,并将额外的匹配作为页面参数传递。

像这样的东西:

RewriteRule ^all/([^/\.]+)/([^/\.]+)/?$ all.php?id=$1&page=$2 [L]
于 2012-12-10T04:51:06.143 回答