我有一个网址
api / something / json?callback = abc,我想将其重定向到
dothis.php strEndPoint =东西&安培;回调= ABC&安培;格式= JSON
我尝试的基础htaccess是:
RewriteRule ^ api /(。)/(json)?callback =(。)client.php?strEndPoint = $ 1& callback = $ 3& format =($ 2)
似乎不起作用:p
答案 0 :(得分:0)
测试
使用。*
RewriteEngine On
RewriteCond %{QUERY_STRING} callback\=(.*)
RewriteRule /api/(.*)/(json) /client.php?strEndPoint=$1&callback=%1&format=$2 [R=301]
你可以删除r = 301仅用于测试
$ curl localhost/api/1111/json?callback=2222 -I
HTTP/1.1 301 Moved Permanently
Date: Fri, 01 Nov 2013 03:16:25 GMT
Server: Apache/2.2.24 (Unix) DAV/2 mod_ssl/2.2.24 OpenSSL/0.9.8y
Location: http://localhost/client.php?strEndPoint=1111&callback=2222&format=json