homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

Redirect That Won't Allow The User To Go Back

 6:23 pm on Oct 7, 2008 (gmt 0)

I am not good at PHP at all so I will ask the experts:

I am looking for some sort of a redirect that will not allow the user to go back.

Lets say the user clicks a banner on Domain1.com

I want that banner to go through a redirect and land on Domain2.com

If the user hits back I want them to not go back to domain1.com. I want to either push them back to domain2.com or send them to a completely different domain; domain3.com

How can I accomplish this?

Thanks greatly.



 7:13 pm on Oct 7, 2008 (gmt 0)

You`ve got your work cut out. What is the person opens the banner link in a new tab? I would assume cookies is your best bet.



 7:46 pm on Oct 7, 2008 (gmt 0)

well you can do this if when they click on banners it results in a post. If you make them forms you can pass in values for going_to and came_from

So you would set up a redirect page that your banners post to. Then when users click a banner from Domain1.com... that will result in a post to your redirect page make sure you pass in values came_from and going_to, in this case "came_from=Domain1.com" and "going_to=Domain2.com"

When the request comes into the redirect page simply check the going_to page and force a redirect from this page to the going_to page.

If the user hits back it will repost the form data and they will get redirected back to Domain2.com

If you want to do a redirect to Domain3.com if they hit back then just add in code that checks to see if came_from equals the referrer.... if they hit back it won't and you can redirect to Domain3.com

[edited by: Demaestro at 7:50 pm (utc) on Oct. 7, 2008]


 7:46 pm on Oct 7, 2008 (gmt 0)

Also... I think if you open in a new tab there is no back button.


 7:48 pm on Oct 7, 2008 (gmt 0)

Mess with my UI and you lose me forever.

I won't come back to the site another day.


 8:07 pm on Oct 7, 2008 (gmt 0)

What are you using this for? Do you own Domain1? Are you trying to disable the back button so that people who stumble upon your site can't leave easily...and even worse...redirecting them to sites as link exchanges? If so, I would advise NOT doing this as you won't last long.

If not, then gs1md is right. Do not mess with browser functions such as the back button or no one will be coming back.

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved