REST API: Always add index.php to the REST URL when pretty permalinks are disabled.

When pretty permalinks are disabled, the web server will internally forward requests to `index.php`. Unfortunately, nginx only forwards HTTP/1.0 methods: `PUT`, `PATCH`, and `DELETE` methods will return a 405 error.

To work around this nginx behaviour, including `index.php` in the REST URL skips the internal redirect.

Fixes #40886.



git-svn-id: https://develop.svn.wordpress.org/trunk@41139 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Gary Pendergast
2017-07-25 00:49:22 +00:00
parent 44491ba49f
commit 029ce05801
5 changed files with 65 additions and 60 deletions
+2 -2
View File
@@ -314,9 +314,9 @@ class Tests_REST_API extends WP_UnitTestCase {
// In non-pretty case, we get a query string to invoke the rest router.
$this->set_permalink_structure( '' );
$this->assertEquals( 'http://' . WP_TESTS_DOMAIN . '/?rest_route=/', get_rest_url() );
$this->assertEquals( 'http://' . WP_TESTS_DOMAIN . '/index.php?rest_route=/', get_rest_url() );
}
/**
* @ticket 34299
*/