问题
I want to convert the url:
http://example.com/calendar/?start=1281052769&end=1283731169
into the url:
http://example.com/calendar/1281052769/1283731169
This is what I have tried:
RewriteEngine on
RewriteCond %{QUERY_STRING} start=(.*)
RewriteCond %{QUERY_STRING} end=(.*)
RewriteRule ^calendar$ http://example.com/calendar/%1/%2[R,L]
回答1:
RewriteEngine On
RewriteBase /
RewriteCond %{QUERY_STRING} ^start\=([^&]+)\&end\=([^&]+)$
RewriteRule ^$ /calendar/%1/%2 [R,L]
来源:https://stackoverflow.com/questions/3420204/htaccess-get-url-to-uri-segments