Need your help! Redirect PHP script

Brendo

Regular Member
Joined
Aug 20, 2012
Messages
410
Reaction score
179
Hello guys,
I'm trying to find out how to create php redirect script, which to look for particular keyword and then to redirect the user to the desired file. I want to hide the location of the file, that's why I need this script and I'm a total noob in coding. I have around 40 files, which I want to hide using this script. I'd be really thankful if you guys give me some code or at least give me some directions how to do it myself. Thank you!
 
Use this if you want to redirect user:
header("Location: __PATH_TO_YOUR_FILE");
Use some if else condition to determine the path.
Then you are done :)
 
Thank you! I've done what I wanted. I check the referrers and then redirect to the appropriate files.
 
In my experience, unless you need something specifically offered by regular expressions: it's quicker and more efficient to use strstr() or other functions like it (e.g. strpos/stripos).
 
In my experience, unless you need something specifically offered by regular expressions: it's quicker and more efficient to use strstr() or other functions like it (e.g. strpos/stripos).

True. Things like this should be done with simple string functions like strpos. Regex, preg_match,ereg_match is an overkill unless you are filtering a junk with some expressions.
 
Back
Top