Skip to content

Instantly share code, notes, and snippets.

@tertek
Last active June 7, 2022 06:52
Show Gist options
  • Save tertek/cde84ed636aabdd016ca6ea0a415e558 to your computer and use it in GitHub Desktop.
Save tertek/cde84ed636aabdd016ca6ea0a415e558 to your computer and use it in GitHub Desktop.
Rewrite Rules needed for pretty URLs for the REDCap Module Repo API
RewriteEngine On
# Rewrite Rules needed for pretty URLS for the Modules API
# Add trailing slash to all requests within /api directory
RewriteCond %{REQUEST_URI} !(/$|\.)
RewriteRule (.*) %{REQUEST_URI}/ [R=301,L]
# Route URL Query parameters to pretty URls with "endpoints" - DO NOT CHANGE THE ORDER - can break things
RewriteRule ^v1/$ ?NOAUTH&pid=472&type=module&prefix=em_submission_module&page=module-repo-api
RewriteRule ^v1/modules/$ ?NOAUTH&pid=472&type=module&prefix=em_submission_module&page=module-repo-api&action=get-all
RewriteRule ^v1/modules/(.*)/release-notes/(.*)/$ ?NOAUTH&pid=472&type=module&prefix=em_submission_module&page=module-repo-api&action=get-release-notes&module=$1&range=$2
RewriteRule ^v1/modules/(.*)/release-notes/$ ?NOAUTH&pid=472&type=module&prefix=em_submission_module&page=module-repo-api&action=get-release-notes&module=$1
RewriteRule ^v1/modules/(.*)$ ?NOAUTH&pid=472&type=module&prefix=em_submission_module&page=module-repo-api&action=get-single&module=$1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment