如何重写多个参数url

时间:2015-02-22 13:35:22

标签: .htaccess url url-rewriting

我有一些网址重写问题。 我有这样的网址:

http://url.com/?page=post&id=1&title=astanadaghy-qorghanys-ministrliigiiniinh-janyndaghy-jarylys-jayly-janha-aqparat

我想要这样的东西:

http://url.com/posts/1-astanadaghy-qorghanys-ministrliigiiniinh-janyndaghy-jarylys-jayly-janha-aqparat.html

怎么做?

1 个答案:

答案 0 :(得分:0)

在.htaccess文件中

RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^/?posts/([0-9]+)-([^\.*]+).html$ index.php?page=post&id=$1&title=$2 [L,QSA]