
PHP Redirect on WordPress Site
- or -
Post a project like this- Posted:
- Proposals: 9
- Remote
- #1470772
- Awarded







Description
Description of requirements/features: I have a website that allows people to download files. Due to medical laws, users have to confirm that they are a medical professional. I currently have a popup etc that confirms all of this. I have also installed Simple Download Monitor to mask the file url. The problem I now have is that if a user shares the masked url with someone else they are able to download the file. My aim is to redirect users if they did not come from another page on our website.
The download URL is formatted as such:
http://[domain]/?smd_process_download=1&download_id=628
I have the following code:
$referrer = $_SERVER['HTTP_REFERER'];
$actual_link = "$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
echo 'Referrer: '.$referrer.'';
echo 'Actual Link: '.$actual_link;
if ((strpos($referrer, '[domain]') !== false) && (strpos($actual_link, 'smd_process_download') !== false)) {
// true
} else {
// false
header('Location: http://google.com');
}
The aim is that if the referrer url does not contain our domain and the url does contain the smd_process_download string then to redirect the user to the homepage.
Currently the code redirects any page request to Google which obviously isn't useful!
What have a missed within this and is there a better way to do this?
Thanks in advance!
Extra notes:

Ben H.
98% (9)New Proposal
Login to your account and send a proposal now to get this project.
Log inClarification Board Ask a Question
-
Is this project available for bidding?
-
can we do it for you
-
Are you in a rush or flexible on deadline?
-
Hello,
I've read and understood your requirements.
Securing 5 years of experience in PHP and Wordpress.
*** Able to execute your requirements.
Looking forward to hearing from you.
With kind regards,
Pooja -
Dear Ben H.
can you please tell me now what problem are you facing? i can be help you what you exactly want -
HI, Can you clear the below points?
- Do you have text content and images ready?
- How many pages do you need?
- Do you have any similar example in mind to follow?
- Are you familiar with WordPress CMS? -
Can we discuss in detail?
-
Hey,
Please open PMB for a brief discussion over the project.
Thanks & Regards,
Sean