.htaccess获取uri段的url

时间:2010-08-06 00:36:06

标签: mod-rewrite

我想转换 网址:

http://example.com/calendar/?start=1281052769&end=1283731169

进入网址:

http://example.com/calendar/1281052769/1283731169

这就是我的尝试:

RewriteEngine on
RewriteCond   %{QUERY_STRING} start=(.*)
RewriteCond   %{QUERY_STRING} end=(.*)
RewriteRule   ^calendar$     http://example.com/calendar/%1/%2[R,L]

1 个答案:

答案 0 :(得分:1)

RewriteEngine On
RewriteBase /

RewriteCond %{QUERY_STRING} ^start\=([^&]+)\&end\=([^&]+)$
RewriteRule ^$ /calendar/%1/%2 [R,L]