我正在使用RESTful回调接口。 我在.htaccess中的重写规则应该重定向调用
PUT http://localhost/testiceman/iceman/users/maverick
to
PUT http://localhost/testiceman/iceman.php?method=users&name=maverick.
重写规则是:
Options +FollowSymLinks
RewriteEngine On
RewriteRule ^testiceman/([^.]+)/([^.]+)/([^.]+)$
/testiceman/$1.php?method=$2&name=$3
RewriteRule ^testiceman/([^.]+)/([^.]+)$ /testiceman/$1.php?method=$2
要检查重定向规则是否正常工作,我在Mozilla Firefox中使用名为“Poster”的插件。
我收到错误:
Status 405:MEthod not Allowed
<
?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<title>Method not allowed!</title>
<link rev="made" href="mailto:postmaster@localhost" />
<style type="text/css"><!--/*--><![CDATA[/*><!--*/
body { color: #000000; background-color: #FFFFFF; }
a:link { color: #0000CC; }
p, address {margin-left: 3em;}
span {font-size: smaller;}
/*]]>*/--></style>
</head>
<body>
<h1>Method not allowed!</h1>
<p>
The PUT
method is not allowed for the requested URL.
</p>
<p>
If you think this is a server error, please contact
the <a href="mailto:postmaster@localhost">webmaster</a>.
</p>
<h2>Error 405</h2>
<address>
<a href="/">localhost</a><br />
<span>05/22/12 11:43:59<br />
Apache/2.2.21 (Win32) mod_ssl/2.2.21 OpenSSL/1.0.0e PHP/5.3.8 mod_perl/2.0.4 Perl/v5.10.1</span>
</address>
</body>
请纠正。