URL重写动态链接

时间:2013-04-24 11:46:16

标签: php mod-rewrite dynamic

我不确定如何将动态网址重新编写为另一种动态网址?

我想改变:

/blog/category.php?catseourl=ExampleCat&pn=1
/blog/category.php?catseourl=ExampleCat&pn=2
/blog/category.php?catseourl=ExampleCatTwo&pn=1

分为:

/blog/category/ExampleCat/1
/blog/category/ExampleCat/2
/blog/category/ExampleCatTwo/1

我已经到了这一步:

RewriteRule ^blog/category/([^/]*)$ /blog/category.php?catseourl=$1&pn=$1 [L] 

但我不确定如何将动态更改添加到重写的左侧?

感谢您的帮助。

3 个答案:

答案 0 :(得分:1)

尝试

RewriteRule ^blog/category/([^/]+)/([0-9]+)/?$ /blog/category.php?catseourl=$1&pn=$2 [L] 

答案 1 :(得分:0)

RewriteEngine On
RewriteRule ^blog/category/([^/]*)/([^/]*)/?$ /blog/category.php?catseourl=$1&pn=$2 [L]

答案 2 :(得分:0)

试试这个:

RewriteRule ^blog/category/(.+)/([0-9]+)$ /blog/category.php?catseourl=$1&pn=$2 [L] 
相关问题