Hi, I have a subdomain http://dl.example.com/ where all the download files are located. The subdomain actually is http://www.example.com/dl/ I want to redirect traffic in case the user is trying to download a file that does not exist. Something like http://dl.example.com/ -> http://www.example.com/ I tried: ErrorDocument 404 http://www.example.com/listoffiles.php Code (markup): But that does not work at all, any idea what the problem could be? What should I do? Many thanks FFMG
ErrorDocument 404 /listoffiles.php I think you are NOT allowed in error doc to have full URL but only as above that's what I use successfully on my site in some folders try
Thanks, but how would you go back one directory? Would: ErrorDocument 404 ../listoffiles.php Code (markup): Be valid? FFMG.
ErrorDocument 404 ../listoffiles.php Code (markup): Be valid? FFMG.[/QUOTE] Actually, I just tried and it does not work... FFMG
subdomain is like domain just different your root is http://dl.example.com and that is where /listoffiles.php can go and no further because sub.domain is bound to its own root directory easiest is to get your /listoffiles.php INTO your sub-domain-directory example.com/dl/listoffiles.php if you then place above error code line - then you get what you want I am sure other people here may have smarter rewrite rules - later after xmas days
In the end I did a bit of work around, not sure if it is the best way. In http://dl.example.com I have ErrorDocument 404 listoffiles.php Code (markup): And in case the user accesses it directly, (because http://dl.example.com/ is actually http://www.example.com/dl/), in http://www.example.com/dl/ I have another. ErrorDocument 404 listoffiles.php Code (markup): This listoffiles.php simply has <?php inlcude "../listoffiles.php" ?> Code (markup): while the base listoffiles.php does a redirect to the actual page/site I want to go on my server. Not the prettiest, but it works fine as far as my logs tell me. FFMG