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? 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'); ?> 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? 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'); ?> 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. 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
Archived
This topic is now archived and is closed to further replies.