.htaccess get url to uri segments

一个人想着一个人 提交于 2019-12-12 17:43:06

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!