latino.ad7 Posted February 27, 2010 Share Posted February 27, 2010 Let's say my website is www.aaa.com (just as an example). I have a sub-folder, called "download". Now I don't want someone to just type www.aaa.com/download and get the list of the files. How is it possible to redirect to the main page of www.aaa.com from that sub-folder? I was thinking to place index.php in the sub-folder and put something like require_once ('http://www.aaa.com'); but this doesn't seem to work. Any ideas? Quote Link to comment https://forums.phpfreaks.com/topic/193564-how-to-redirect-from-a-folder/ Share on other sites More sharing options...
jl5501 Posted February 27, 2010 Share Posted February 27, 2010 You are on the right track, and one way to make it work, is to have an index.php in the subfolder and all it contains is this <?php header('location: www.aaa.com'); ?> Quote Link to comment https://forums.phpfreaks.com/topic/193564-how-to-redirect-from-a-folder/#findComment-1018956 Share on other sites More sharing options...
latino.ad7 Posted February 27, 2010 Author Share Posted February 27, 2010 If I do that and go to www.aaa.com/download, then it tries to go to www.aaa.com/download/www.aaa.com. Hm, how to fix it? Quote Link to comment https://forums.phpfreaks.com/topic/193564-how-to-redirect-from-a-folder/#findComment-1018962 Share on other sites More sharing options...
harristweed Posted February 27, 2010 Share Posted February 27, 2010 <?php header('location: ../index.php'); ?> Quote Link to comment https://forums.phpfreaks.com/topic/193564-how-to-redirect-from-a-folder/#findComment-1018965 Share on other sites More sharing options...
latino.ad7 Posted February 27, 2010 Author Share Posted February 27, 2010 OK, thanks. Solved. Quote Link to comment https://forums.phpfreaks.com/topic/193564-how-to-redirect-from-a-folder/#findComment-1018975 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.