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?

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>

Hmmm... i haven't tried that.

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

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

Oh okay, thanks for the assisstance. i got it now :D

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.