Created
December 3, 2025 13:04
-
-
Save abdulawal39/0217e27ecbed359394948e231d8902c0 to your computer and use it in GitHub Desktop.
Custom redirection php code for WFAM
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Custom Redirects for WFAM | |
| */ | |
| $request_uri = $_SERVER['REQUEST_URI']; | |
| $request_path = strtok($request_uri, '?'); | |
| // Match: /wp-content/uploads/anything.extension | |
| if (preg_match('#^/wp-content/uploads(/.*\.\w+)$#', $request_path, $matches)) { | |
| // Set the query parameter | |
| $_GET['wfam_requested_file'] = $matches[1]; | |
| $_REQUEST['wfam_requested_file'] = $matches[1]; | |
| // Include WordPress | |
| require_once(__DIR__ . '/index.php'); | |
| exit; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment