Skip to content

Commit 804bc56

Browse files
committed
Use full REST API URL (with index.php)
"Nice" REST API URLs are configured in MantisBT api/rest/.htaccess file. If the Apache setup does not allow overrides, then the web server will return 404 errors because mod_rewrite is not enabled. To avoid issues on sites where URL rewriting does not work, we use the full URL with index.php for AJAX requests, i.e. http://example.com/mantis/api/rest/index.php/plugins/Snippets/... instead of the "nice" URL http://example.com/mantis/api/rest/plugins/Snippets/... Fixes #31
1 parent efd4fc3 commit 804bc56

2 files changed

Lines changed: 12 additions & 1 deletion

File tree

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,14 @@ specification.
88

99
--------------------------------------------------------------------------------
1010

11+
## [Unreleased]
12+
13+
### Fixed
14+
15+
- Can't retrieve snippets data from REST API if URL rewriting is not working
16+
[#31](https://github.com/mantisbt-plugins/snippets/issues/31)
17+
18+
1119
## [2.2.0] - 2018-01-14
1220

1321
### Changed
@@ -184,6 +192,7 @@ specification.
184192

185193
[Unreleased]: https://github.com/mantisbt-plugins/snippets/compare/v2.2.0...HEAD
186194

195+
[2.2.1]: https://github.com/mantisbt-plugins/snippets/compare/v2.1.0...v2.2.0
187196
[2.2.0]: https://github.com/mantisbt-plugins/snippets/compare/v2.1.0...v2.2.0
188197
[2.1.0]: https://github.com/mantisbt-plugins/snippets/compare/v2.0.0...v2.1.0
189198
[2.0.0]: https://github.com/mantisbt-plugins/snippets/compare/v1.2.0...v2.0.0

files/snippets.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@ jQuery(document).ready(function($) {
1111
* @returns {string} REST API URL
1212
*/
1313
function rest_api(endpoint) {
14-
return "api/rest/plugins/Snippets/" + endpoint;
14+
// Using the full URL (through index.php) to avoid issues on sites
15+
// where URL rewriting is not working (#31)
16+
return "api/rest/index.php/plugins/Snippets/" + endpoint;
1517
}
1618

1719
/**

0 commit comments

Comments
 (0)