Results 1 to 9 of 9
  1. #1
    Full Member
    Join Date
    January 18th, 2005
    Posts
    331
    I don't know if this can be done or not but I figure someone here will..

    I'm trying to create an area (subdomain or subdirectory) for people to go to ONLY if they access from my main page without fancy passwords/db scripts.

    The problem is that once they are there they could just see the URL in the address bar and bookmark and go back.. I would like to prevent anynone from getting to this area unless they are specifically redirected from the main page..

    Ex: You get to www.domain.com and click on "Take me home" and it takes you to subdomain.domain.com. Now, if you are at www.yahoo.com and type in subdomain.domain.com you get directed to an error page that says you must have proper access rights..

    Is something like this possible or would I have to write an actual login screen and verify??

    Thanks

  2. #2
    Moderator MichaelColey's Avatar
    Join Date
    January 18th, 2005
    Location
    Mansfield, TX
    Posts
    16,232
    You could always check the referrer and redirect them to an error page (or just back to the mail page on your main site) if they didn't get there from the your main site. It's not foolproof. Some browsers hide the referrer, so those users would never be able to get there. Spiders don't usually send referrers, so they would never get there.

    It gets a little more complicated if this "subsite" is more than just a single page, but it can still be done. Just check the referrer to see if they're coming from an internal link or your main page, otherwise rediret to the error page.
    Michael Coley
    Amazing-Bargains.com
     Affiliate Tips | Merchant Best Practices | Affiliate Friendly? | Couponing | CPA Networks? | ABW Tips | Activating Affiliates
    "Education is the most powerful weapon which you can use to change the world." Nelson Mandela

  3. #3
    Full Member
    Join Date
    January 18th, 2005
    Posts
    331
    Mike,

    would that be done with the htaccess file or are you talking of checking it another way?

  4. #4
    Full Member
    Join Date
    January 18th, 2005
    Posts
    322
    If you’re on an apache server, I think you could do this using mod_rewrite in your .htaccess file. I’m pretty sure you can set up a RewrirteCond based on the HTTP_REFERER. If it doesn’t match a page on your domain you can then use the RewriteRule to direct people to your index page. That way you could have more than one page in your subdirectory and people could navigate feely as long as they are referred by another page on your site. Then if they try to type the page in directly, they get directed to your main page and can proceed from there.

    On the other hand, you could just frame the subdirectory/subdomain. That way people wouldn’t see the real address in their browsers, so wouldn’t know what it is to do a type in. Of course, they could find out, but depending on how tech savvy your visitors are, it might not matter.

  5. #5
    Member
    Join Date
    January 18th, 2005
    Location
    Orlando, FL
    Posts
    122
    you could also establish a cookie or session variable on the main domain that you can then check for on the sub domain. If it is not there, then you just redirect them to the home page.
    Chris Mayr
    When amassed, even dust can become a mountain.

    There is a finite amount of intelligence but an infinite amount of stupidity in the universe

  6. #6
    Full Member
    Join Date
    January 18th, 2005
    Posts
    331
    Maybe one of the problems is that I have never worked with the referer or the .htaccess before. .. Any good ideas for tutorials or code code examples??

  7. #7
    2005 Linkshare Golden Link Award Winner  ecomcity's Avatar
    Join Date
    January 18th, 2005
    Location
    St Clair Shores MI.
    Posts
    17,328
    What you trying to hide there....on the cheap? Most just easily setup up a password protected area with a script or Frontpage. Some even charge the inner club for access. Some have more info folks are willing to pay for that requires more then one page. All cater to loud mouth tricksters who pass on the unprotected URLs and passwords...LOL.
    Webmaster's... Mike and Charlie

    "What have you done today to put real value into a referral click...from a shoppers viewpoint!"

  8. #8
    Full Member
    Join Date
    January 18th, 2005
    Posts
    331
    <BLOCKQUOTE class="ip-ubbcode-quote"><font size="-1">quote:</font><HR>Originally posted by EcomCity.com:
    What you trying to hide there....on the cheap? Most just easily setup up a password protected area with a script or Frontpage. Some even charge the inner club for access. Some have more info folks are willing to pay for that requires more then one page. All cater to loud mouth tricksters who pass on the unprotected URLs and passwords...LOL. <HR></BLOCKQUOTE>

    Sorry Mike, no plans on overthrowing the government or conquering the affiliate world from me.. Just trying to use a simple keyword access http://www.mindpalette.com/scripts/k...nav/index.html to a spot on the site based on names and make sure they go through the main page first..

    Simple for some but hard for us simple folks

  9. #9
    Full Member
    Join Date
    January 18th, 2005
    Posts
    331
    Thanks for the direction guyz.. Got it working using the htaccess file and in case anyone is curious, here is the code.

    RewriteEngine On
    RewriteCond %{HTTP_REFERER} !^http://([a-z0-9-]+\.)*yourdomain.com/ [NC]
    RewriteRule /* http://www.yourdomain.com/errorpage.html [L,R]

  10. Newsletter Signup

+ Reply to Thread

Similar Threads

  1. Time for people to stop setting off fireworks
    By SSanf in forum Midnight Cafe'
    Replies: 9
    Last Post: July 5th, 2004, 09:01 AM
  2. Some people just never stop!
    By Haiko de Poel, Jr. in forum Midnight Cafe'
    Replies: 37
    Last Post: July 1st, 2003, 08:20 AM
  3. Stop Pop Ups or Stop Spam software
    By JP Sauve in forum Programming / Datafeeds / Tools
    Replies: 0
    Last Post: June 2nd, 2003, 09:52 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •