farfel Posted August 30, 2012 Share Posted August 30, 2012 If I'm using dnsspoof to redirect all clients to the Pineapple's web server ... that will run index.php (and in default configuration, redirect.php). But what if my destination page contains links to other pages? Clicking those links will run index.php again instead of loading the page the user requested. For example, index.php refreshes to /usb/htdocs/page1.html, or redirect.php sends them to that page. page1.html has a link to page2.html, but that link won't work. Clicking the link sends them back to index.php and they end up on page1.html again. How to make these internal links work? Quote Link to comment Share on other sites More sharing options...
Scale Posted August 30, 2012 Share Posted August 30, 2012 Working of theory, i don't have my pineapple at the moment. When a user goes to a page like facebook.com/friends, there will be a dns request for facebook.com. Which results in a IP address, All further requests on the facebook.com domain will be send to that IP address. So i believe if you link on the same domain it should not redirect you back. Quote Link to comment Share on other sites More sharing options...
amoeba Posted August 30, 2012 Share Posted August 30, 2012 (edited) Try like this in your redirect.php <?php$ref = "http://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];if (strpos($ref, "index2")) { header('Location: index2.html'); }if (strpos($ref, "index3")) { header('Location: index3.html'); }require('index.html');?>[/CODE]And you need to have <title>index2</title> and so on in your html code for the pages. Edited August 30, 2012 by amoeba Quote Link to comment Share on other sites More sharing options...
farfel Posted August 30, 2012 Author Share Posted August 30, 2012 Thanks for your help Amoeba. I see you are in Sverige so I will say Tack Sa Mycket. And you need to have <title>index2</title> and so on in your html code for the pages. OK, why is that? REQUEST_URI is supposed to contain the URI, not the page title. Quote Link to comment Share on other sites More sharing options...
farfel Posted August 31, 2012 Author Share Posted August 31, 2012 Amoeba, I found that your code only works if all the pages are in /www I need the pages to be in /usb/htdocs/ When I use /usb/htdocs/pageN.html in redirect.php, the redirect does not work. Instead it returns a URL like: www.anything.com/usb/htdocs/redirect.php (...and the browser hangs) instead of: www.anything.com/usb/htdocs/pageN.html . Quote Link to comment Share on other sites More sharing options...
PineDominator Posted August 31, 2012 Share Posted August 31, 2012 (edited) Amoeba, I found that your code only works if all the pages are in /www I need the pages to be in /usb/htdocs/ When I use /usb/htdocs/pageN.html in redirect.php, the redirect does not work. Instead it returns a URL like: www.anything.com/usb/htdocs/redirect.php (...and the browser hangs) instead of: www.anything.com/usb/htdocs/pageN.html . sym link anything outside of /www/ to /www/, the web server can't see outside of /www/ Edited August 31, 2012 by petertfm Quote Link to comment Share on other sites More sharing options...
amoeba Posted August 31, 2012 Share Posted August 31, 2012 Amoeba, I found that your code only works if all the pages are in /www I need the pages to be in /usb/htdocs/ When I use /usb/htdocs/pageN.html in redirect.php, the redirect does not work. Instead it returns a URL like: www.anything.com/usb/htdocs/redirect.php (...and the browser hangs) instead of: www.anything.com/usb/htdocs/pageN.html . Like peterfm said, create symbolic links, look in this thread Quote Link to comment Share on other sites More sharing options...
farfel Posted August 31, 2012 Author Share Posted August 31, 2012 ln -s /usb/htdocs/* /www/[/CODE]worked, thank you. Quote Link to comment 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.