abdfahim Posted December 11, 2008 Share Posted December 11, 2008 I want to redirect the visitor to a certain page located at root directory using header function. I have two difficulties though 1) My server has a dynamic IP, as a result of that I cant use a direct path in my header location like http://123.123.123.123/mypge.php 2) I cant use a relative path in header location like ../mypage.php because the files where I put the header funtion located at different directories and subdirectories. I tried to use the following function in the server hosted at my PC /$_SERVER["HTTP_HOST"]/mypage.php but it returns http://localhost/localhost/mypage.php (watch two localhost) can anyone help? Link to comment https://forums.phpfreaks.com/topic/136495-solved-redirect-to-a-page-at-root-directory/ Share on other sites More sharing options...
Mark Baker Posted December 11, 2008 Share Posted December 11, 2008 So use an absolute path: /mypage.php Link to comment https://forums.phpfreaks.com/topic/136495-solved-redirect-to-a-page-at-root-directory/#findComment-712461 Share on other sites More sharing options...
Twister1004 Posted December 11, 2008 Share Posted December 11, 2008 Or you could do this, ./mypage.php It works all the time =) (Not two dots, but one) Link to comment https://forums.phpfreaks.com/topic/136495-solved-redirect-to-a-page-at-root-directory/#findComment-712463 Share on other sites More sharing options...
abdfahim Posted December 11, 2008 Author Share Posted December 11, 2008 thanx Mark Baker .. its funny that i used that method unsuccessfully with include and so I thought it wouldn't work with header !! I forgot the main diff betn include and header !! .... thnx again .. Link to comment https://forums.phpfreaks.com/topic/136495-solved-redirect-to-a-page-at-root-directory/#findComment-712467 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.