susom / redcap-redirect

A few files to handle outdated and removed redcap version numbers in urls
Apache License 2.0
6 stars 7 forks source link

Differences between .htaccess file and redcap_redirect.php comment #4

Closed kirenotneb closed 2 years ago

kirenotneb commented 3 years ago

We recently switched servers (RedHat :arrow_right: Ubuntu) both with Apache 2.4. Previously, we were using the .htaccess approach to perform the Rewrite, but with the new server we opted to set it up in the main Apache configuration. We noticed that some URLs stopped working correctly after the migration, specifically any URLs that omitted the index.php as part of the address. For example: https://example.edu/redcap_v10.7.1/ExternalModules/?prefix=api_sync&page=api-sync&pid=9999, does not include the index.php after the ExternalModules part of the path. This was triggering the plugin to return a 404, with the plugin 404 styling.

While troubleshooting I noticed a difference between the .htaccess and redcap_redirect.php

9c26
<         RewriteRule "^(.+)$"     "/redcap_redirect.php"   [PT,L]
---
>         RewriteRule "^(.+)$"     "/redcap_redirect.php"   [PT,L,NS]

It appears the missing NS flag prevents the plugin from accepting the implicit index.php. After updating the Apache config including the missing NS flag it began redirecting correctly to all the addresses.

123andy commented 3 years ago

Do you have the latest version of redcap_redirect? The NS flag has been there for a while I think...

kirenotneb commented 3 years ago

I made sure to update the redcap_redirect.php just before troubleshooting again, but this difference is between the .htaccess file and the comment in the redcap_redirect file.

aarenson commented 2 years ago

Agreeing with kirenotneb that .htaccess looks like it should be updated to use NS on the RewriteRule

123andy commented 2 years ago

I modified the .htaccess - 9668d1374886b3c6fca14bf8aa2b8fc86c2011d5.