Thursday, January 27, 2022

[FIXED] Redirect all URL calls to a particular php file

Issue

Any http request (e.g. to pdf) should be redirected to validate.php so if you call an URL (e.g. http:...../whatever/whatever/1.pdf), htaccess should execute validate.php instead.

I went through many examples on web and stackoveflow, no luck yet. Since most work fine for many people, I guess there must be something wrong with my server.

How can I solve this issue?

Thanks

Note: htaccess and validate.php files are stored in the root.

And many more.


Solution

put this code in your DOCUMENT_ROOT/.htaccess file:

RewriteEngine On

RewriteRule \.pdf$ /validate.php [L,NC]


Answered By - anubhava

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.