WordPress.org

Ready to get started?Download WordPress

Forums

Find URL for 403 error page (4 posts)

  1. richards1052
    Member
    Posted 9 years ago #

    I'm trying to implement a php script which will refer visitors fr. a banned domain to an error page. The script asks for the URL of the error pg. you wish to invoke. I'd like to use my 403 error pg. but I have no idea what URL to use. Any ideas?

    Here's the script:
    <?php
    $urls[0]='http://www.domainreferring.com/page';
    $urls[1]='http://domainaddressagainwithoutwww.com/page';
    $ref=strtolower($_SERVER['HTTP_REFERER']);
    $url='http://www.yourdomain.com/or where youwant themtogo.html';
    if(!in_array($ref, $urls)){
    header('Location: '.$url);
    }
    ?>

    I prob. don't need to use any error pg. since I don't want them at the site & don't really need to tell them anything about why they were prevented fr. accessing it. In that case, can I remove the line that starts '$url...'?

    BTW, can anyone find anything in this script that might be causing major screw ups for me when I add it to my header.php file?

  2. Mark (podz)
    Support Maven
    Posted 9 years ago #

    Error pages go where you put them.

    In the .htaccess that covers the domain:

    ErrorDocument 404 /error-pages/404.html
    Errordocument 403 /error-pages/403.html

  3. richards1052
    Member
    Posted 9 years ago #

    So if my blog is http://www.richardsilverstein.com/tikun_olam

    would it look like this:
    http://www.richardsilverstein.com/tikun_olam/Errordocument403/error-pages/403.html

    UPDATE: I guess not since that didn't call up the 403 error pg. I must be missing something...

    I also really need help figuring out what might be wrong with the script or why there's a conflict bet. my installation & this script if anyone has any ideas.

  4. richards1052
    Member
    Posted 9 years ago #

    Thanks, Podz. Found the 403 url. In my case it was at http://www.richardsilverstein.com/403.shtml

Topic Closed

This topic has been closed to new replies.

About this Topic