Driving Me NUTS... Please help - someone...anyone?

Discussion in 'Troubleshooting' started by christop12, Aug 24, 2009.

  1. christop12

    christop12 New Member

    Joined:
    Aug 29, 2006
    Messages:
    27
    Ok.. here is the deal.

    I have a folder that I protect using
    ########### AMEMBER START #####################
    Options +FollowSymLinks
    RewriteEngine On

    etc...
    ########### AMEMBER FINISH ####################

    My problem is as follows:
    All my links for sub folders withing this protected folder are being re-written without the "www" in the url.
    --

    let me clarify:
    a link that goes to: http://www . my site .com/protected/folder
    will return: http:// . my site .com/protected/folder

    BUT a link that goes to http://www . my site .com/protected/folder/filename.html
    will return http://www . my site .com/protected/folder/filename.html

    the www stays.

    I need the www. to ALWAYS stay....because some of my scripts wont work properly otherwise.

    I have in my main (non protected) folder:
    RewriteEngine On
    RewriteCond %{HTTP_HOST} ^my site.com$
    RewriteRule (.*)$ http://www.my site.com/$1 [R=301,L]
    ErrorDocument 400 /
    ErrorDocument 401 /
    ErrorDocument 403 /
    ErrorDocument 404 /404.shtml
    ErrorDocument 500 /
    IndexIgnore *

    and THAT works fine everywhere -- except in my protected folders and sub folders...

    It's driving me "insane..." because we have an update ready to launch...that I cannot launch until this ridiculous "bug" is fixed....

    Thank you to anyhow who can come up with a solution!! I'd be willing to offer design services -- free :)

    I need this yesterday

    Thanks again.
  2. christop12

    christop12 New Member

    Joined:
    Aug 29, 2006
    Messages:
    27
    and another weird thing:

    If the link is written with an end "/" then it works fine too....is that weird or what??

    so a link to http://www . monkeyhead . com / protected / folder 1/
    will return: http://www . monkeyhead . com / protected / folder 1/

    BUT http://www . monkeyhead . com / protected / folder 1
    Will return http:// monkeyhead . com / protected / folder 1/


    argh....
  3. christop12

    christop12 New Member

    Joined:
    Aug 29, 2006
    Messages:
    27
    and one last weird thing..

    when I mouse over the links on my protected index, they "show" with the www. in them... so It is once they are clicked that (and I think that is what is going on) amember rewrites them "wrong..."

    ok...enough ranting... I am going to site by the screen and hope for someone to come up with a fix :-0
  4. christop12

    christop12 New Member

    Joined:
    Aug 29, 2006
    Messages:
    27
    OK... I will up the ante... $150 for he - or she - who saves the day.

    via PayPal.
  5. davidm1

    davidm1 aMember User & Partner

    Joined:
    May 16, 2006
    Messages:
    4,437
    What do you have your amember setup Root URL and Secure Root URL set for?

    David
  6. christop12

    christop12 New Member

    Joined:
    Aug 29, 2006
    Messages:
    27
    Well... I figured I'd post the reply on how I fixed this the "hardcoding" way... I used PHP in all my page's headers as follows -- hope this helps someone out there...

    <?php
    $host = $_SERVER["HTTP_HOST"];


    $host = strtolower($host);
    $host = trim($host);

    $host = str_replace(':80', '', $host);
    $host = trim($host);

    if ($host != 'www.your-site-name here.com'){

    header('HTTP/1.1 301 Moved Permanently');

    $url = isset($_SERVER["REQUEST_URI"]) ? $_SERVER["REQUEST_URI"] : '';

    header('Location: http://www.your- site name here.com' . $url);

    $url = htmlspecialchars($url);

    print '<a href="http://www.yoursite name here.com' . $url.'">Please click here</a>';

    exit;
    }


    ?>

    put that in before the header closing tag </head> ..

    this will make sure that all your pages show "www" in the url....
  7. christop12

    christop12 New Member

    Joined:
    Aug 29, 2006
    Messages:
    27
    put that in before the header closing tag </head> ..

    this will make sure that all your pages show "www" in the url....

Share This Page