Go Back   PCMech Forums > Help & Discussion > Internet, Web Applications, & The Cloud

Need Some Help? Type Your Keywords Here:

Reply
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Old 02-20-2003, 09:43 AM   #1
Member (6 bit)
 
Join Date: Apr 2002
Location: new orleans, la
Posts: 55
Question "redirect" question

hi, i have a page on my website that i don't want surfers to be able to access without viewing the home page first. is there some html coding for this. i also don't have a cgi bin. thanks for any info.
-jon
jon321 is offline   Reply With Quote
Old 02-20-2003, 10:01 AM   #2
Staff
Premium Member
 
mairving's Avatar
 
Join Date: Jul 1999
Location: Arlington, TN
Posts: 5,538
You could probably do it pretty easy with PHP. Just make a conditional based on HTTP_REFERER. If the referer was not the home page (or any other page on your site) then you would redirect them to the home page. You could also do it using a .htaccess file. Keep in mind though that visitors to your site don't generally like being redirected.
mairving is offline   Reply With Quote
Old 02-20-2003, 10:08 AM   #3
Premium Member
 
Statica's Avatar
 
Join Date: Jun 1999
Posts: 9,231
Hope this works :)

You could try putting something like
Code:
   alert ("You came from " + document.referrer);
   if (document.referrer != "http://www.site.com/index.html")
      location.href = "index.html";
Which assumes that your main page is at : index.html
and if the previous page that the user visited was not index.html then the user is pushed to index.html
Statica is offline   Reply With Quote
Old 02-20-2003, 10:45 AM   #4
PCMech Founder
Staff
 
drisley's Avatar
 
Join Date: Mar 1999
Location: Tampa, FL
Posts: 1,950
Send a message via ICQ to drisley
Above post was edited to handle a scripting problem.
drisley is offline   Reply With Quote
Old 02-20-2003, 11:46 AM   #5
Member (6 bit)
 
Join Date: Apr 2002
Location: new orleans, la
Posts: 55
thanks, is that javascript? where do i insert it in the html? inside the head tags? also, i have about 20 pages total. if a user is on a page other than index.html and he clicks a link to the page i want to keep closed off, will that bring him to the index.html page as well? i would want to avoid that. thanks.
-jon

Last edited by jon321; 02-20-2003 at 11:50 AM.
jon321 is offline   Reply With Quote
Old 02-20-2003, 11:54 AM   #6
Member (6 bit)
 
Join Date: Apr 2002
Location: new orleans, la
Posts: 55
okay, thanks. i got it to work great. i think i can stand having it redirect users even if they already entered through the main page. but if there is some coding that could remedy that, i'd use it. thanks again.
-jon
jon321 is offline   Reply With Quote
Reply

Bookmarks

Still Need Help? Type Your Keywords Here:


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -5. The time now is 04:22 AM.
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.
SEO by vBSEO 3.6.0 PL2