0

Hi, i have been search for an answer for this for a few hours now and i finally got frustrated...

soooo... how do you create a redirect link that redirects users back to last page they were on? Lets say they are on page A and they visit my site, how do i get it so that they go back to page A and never have access to the page.

Would i have to tweak the .htacess page using php?

2
Contributors
4
Replies
14
Views
4 Years
Discussion Span
Last Post by <M/>
1

Have you tried using the javascript history back object?

Example...

 <script>
 function back(){
 window.history.back();
 }
 </script>

 <a href="javascript:void(0);onclick="back()">Previous Page</a>
0

Hmmm... i haven't tried that.

If i were to use it, whwere would i put it?

1

If i were to use it, whwere would i put it?

I'm assuming you would add a link to your web page that lets the user know if they click on this link it will take them back to where they came from? You can expand on this script to check to see if there is history first by using the length property. If there is, show the link, if not, there is no reason to show the link.

You can get this server side as well... if you are using PHP, it looks like you have access to this server side, $_SERVER['HTTP_REFERER'];, although I'm not very strong on the PHP side so you can do some more research.

In asp.net, you have this method: Request.UrlReferrer

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.