Jump to content

The Heartbreak Of Redirection


farfel

Recommended Posts

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?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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 by amoeba
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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 .

Link to comment
Share on other sites

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 by petertfm
Link to comment
Share on other sites

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

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...