How to redirect visitors

liunx

Guest
I'm not sure which forum this question belongs...sorry.<br /><br />Is there a way to 'force' everyone that visits your site to go to a specified page (such as the index page) even if they have a different page bookmarked?<!--content-->
I have used this before:<br /><br /><!--quoteo--><div class='quotetop'>QUOTE</div><div class='quotemain'><!--quotec--><script language="JavaScript"><br />if (parent.location.href =http://www.totalchoicehosting.com/forums/lofiversion/index.php/= self.location.href){<br />window.location.href = <!-- m --><a class="postlink" href="http://www.totalchoicehosting.com/forums/lofiversion/index.php/'index.html&">http://www.totalchoicehosting.com/forum ... ndex.html&</a><!-- m -->#39;<br />}<br /></script><!--QuoteEnd--></div><!--QuoteEEnd--><br /><br />Just place it in the head section of your html document.<!--content-->
"Wow" and thank you! <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/thumbup1.gif" style="vertical-align:middle" emoid=":thumbup1:" border="0" alt="thumbup1.gif" /> <br /><br />I was incorrectly assuming that it would be much more involved.<!--content-->
You're welcome!<br /><br />Of course, it's only going to work for people that have Javascript enabled in their browser. I don't know if there is another way to do it that will get everyone, Javascript enabled or not.<!--content-->
You can also use something like this. And you can set this part <b>content="1</b> from 1 to 5. That just determines how fast it redirects them.<br /><br /><!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1--><meta http-equiv="Refresh" content="1;url=http://Link to the url you want them to go to here"><!--c2--></div><!--ec2--><!--content-->
JTD, that code isn't javascript-enabled browser dependent, right?<!--content-->
<!--quoteo(post=158811:date=Dec 14 2005, 10:50 AM:name=rnmcd)--><div class='quotetop'>QUOTE(rnmcd @ Dec 14 2005, 10:50 AM) <a href="http://www.totalchoicehosting.com/forums/index.php?act=findpost&pid=158811"><img src='http://www.totalchoicehosting.com/forums/style_images/1/post_snapback.gif' alt='*' border='0' /></a></div><div class='quotemain'><!--quotec-->JTD, that code isn't javascript-enabled browser dependent, right?<!--QuoteEnd--></div><!--QuoteEEnd--><br /><br /><br />No it isnt. Visit this link and you will see how it works. <a href="http://www.phantom309drivers.org/guestbook/" target="_blank">http://www.phantom309drivers.org/guestbook/</a><!--content-->
<!--quoteo(post=158895:date=Dec 15 2005, 06:27 AM:name=JTD)--><div class='quotetop'>QUOTE(JTD @ Dec 15 2005, 06:27 AM) <a href="http://www.totalchoicehosting.com/forums/index.php?act=findpost&pid=158895"><img src='http://www.totalchoicehosting.com/forums/style_images/1/post_snapback.gif' alt='*' border='0' /></a></div><div class='quotemain'><!--quotec-->No it isnt. Visit this link and you will see how it works. <a href="http://www.phantom309drivers.org/guestbook/" target="_blank">http://www.phantom309drivers.org/guestbook/</a><!--QuoteEnd--></div><!--QuoteEEnd--><br /><br /><br />Nice.<br /><br />Out of curiousity, why doesn't it do the redirect when I initially visit:<br /><br /><a href="http://www.phantom309drivers.org/games/" target="_blank">http://www.phantom309drivers.org/games/</a><!--content-->
<!--quoteo(post=158908:date=Dec 15 2005, 09:16 AM:name=rnmcd)--><div class='quotetop'>QUOTE(rnmcd @ Dec 15 2005, 09:16 AM) <a href="http://www.totalchoicehosting.com/forums/index.php?act=findpost&pid=158908"><img src='http://www.totalchoicehosting.com/forums/style_images/1/post_snapback.gif' alt='*' border='0' /></a></div><div class='quotemain'><!--quotec-->Nice.<br /><br />Out of curiousity, why doesn't it do the redirect when I initially visit:<br /><br /><a href="http://www.phantom309drivers.org/games/" target="_blank">http://www.phantom309drivers.org/games/</a><!--QuoteEnd--></div><!--QuoteEEnd--><br /><br /><br />Because I have no redirect setup for that games link. The only link with a redirect is this one. And only because I may have missed changing a few links to various places I visit. I used to have all my sites seperate now they are all phpnuke. <a href="http://www.phantom309drivers.org/guestbook/" target="_blank">http://www.phantom309drivers.org/guestbook/</a><!--content-->
<!--quoteo(post=158985:date=Dec 16 2005, 11:43 AM:name=JTD)--><div class='quotetop'>QUOTE(JTD @ Dec 16 2005, 11:43 AM) <a href="http://www.totalchoicehosting.com/forums/index.php?act=findpost&pid=158985"><img src='http://www.totalchoicehosting.com/forums/style_images/1/post_snapback.gif' alt='*' border='0' /></a></div><div class='quotemain'><!--quotec-->Because I have no redirect setup for that games link. The only link with a redirect is this one. And only because I may have missed changing a few links to various places I visit. I used to have all my sites seperate now they are all phpnuke. <a href="http://www.phantom309drivers.org/guestbook/" target="_blank">http://www.phantom309drivers.org/guestbook/</a><!--QuoteEnd--></div><!--QuoteEEnd--><br /><br />Would there be a way to get each and every person that visits any page on phantom309drivers.org to have to visit another page on your site first?<br /><br />What I would like to ultimately do is make everyone that goes to any page on my site be required to view a "site info" page that tells of important site changes.<br /><br />It would be great if I could set a cookie or something that doesn't take/redirect them through this "site info" page more than once every 24 hours.<br /><br />Upon looking at your redirect I notice that it is different than what I am trying to achieve. I want, for example, users that click on a page like your <a href="http://phantom309drivers.org/modules.php?name=Guestbook" target="_blank">http://phantom309drivers.org/modules.php?name=Guestbook</a> to be automatically redirected through <a href="http://www.phantom309drivers.org/guestbook/" target="_blank">http://www.phantom309drivers.org/guestbook/</a> first.<br /><br />This is probably much more complicated than I anticipated.<!--content-->
Another way to direct is through PHP. You can do it very simply by using the following code...<br /><br /><!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1--><? header("Location: http://www.whatever.com"); ?><!--c2--></div><!--ec2--><!--content-->
 
Back
Top