2

現在、ルートディレクトリにhtaccessファイルがあります。callbacks / api内に新しいhtaccessファイルを作成し、次のように入力しました。

RewriteEngine on
RewriteBase /callbacks/api
RewriteRule ^(.*)\.(json|xml|csv|txt|printr)$ ./endpoint.php?api_request=$1&api_response_type=$2

私は他のhtaccessと同じ書き換えルールに従っています(これは問題なく機能します)。ただし、この場合、次のURLを渡します。

domain.com/callbacks/api/v1/test_rest.xml

私のendpoint.phpファイルの中に:

<?
//just making sure the 500 is not due to php
//so lets just dump the GET's
var_dump($_GET);
?>

書き換えルールの最後に必要なフラグがありませんか?

4

1 に答える 1

1

これを試して:

RewriteEngine on
RewriteBase /callbacks/api
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)\.(json|xml|csv|txt|printr)$ ./endpoint.php?api_request=$1& api_response_type=$2   [L]

ルールをテストしませんでした。ループを防ぐために2行追加しただけです。

于 2013-01-19T22:48:49.280 に答える