Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New to the CF scene
    Join Date
    Aug 2002
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    htaccess error redirect

    I am calling htaccess from:
    mysite-root/webmasters/.htaccess

    using the htaccess code:
    ErrorDocument 401 /tour.html

    activating that error results in:
    tour.html document loads, BUT it loads FROM the 'webmasters' directory,
    ('.../webmasters/main.html' is still in the address bar!)
    Because of this none of the tour image sources are correct and none show.
    AND the htaccess continues to request the username-password access info.

    What goes?

    At this point the only thing which works for me is to insert HTML
    into the htaccess:
    ErrorDocument 401 "<meta http-equiv="refresh" content="0;URL=http://www.mysite.com/tour.html">"
    Which does what I want...to be redirected to the COMPLETE tour page AT its correct location.

    But is this really the only way to get this to happen correctly?

  • #2
    New to the CF scene
    Join Date
    Aug 2002
    Location
    India
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts
    As I can understand with mysite-root/webmasters/.htaccess is
    The home for your site is mysite-root/

    You should write .htaccess file in your default root only so that it work for whole site.

    The content of .htaccess
    ErrorDocument 401 /tour.html

    is correct.

    After writeing the content to .htaccess please put this file in
    mysite-root/.htaccess
    not in
    mysite-root/webmasters/.htaccess

    This will solve your problem.

  • #3
    New to the CF scene
    Join Date
    Aug 2002
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Except that I definitely don't want to restrict access to the root site as that is the free-to-the-public area. I need to only restrict access to the webmasters directory.

  • #4
    Regular Coder Feyd's Avatar
    Join Date
    May 2002
    Location
    Los Angeles, CA Maxim: Subvert Society
    Posts
    404
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Basically, (from what I can infer from a strange description ) you've got a lot of strange entries...you're missing some basic logic about placement of specific pieces.

    yoursite/webmasters/ is protected, correct? With whatever method. And you want people who do not have the response to your authentication challenge to be redirected (via the 401 error code) to yoursite/tour.html?

    First of all, your 401 redirect is going to be global, no matter where they try and enter, they are always going to /tour.html if they fail. (Additionally, this is not exactly the best way to do it, Vaneet is correct that this 401 redirect htaccess should be placed IN yoursite/webmasters/ with your pw protecton, but have the tour.html redirect to yoursite/tour.html as usual)

    Also, your /tour.html should be using virtual paths to its images (such as /images/file.gif being equivalent to yoursite.com/images/file.gif so that no matter where in the site they are, the images will be referenced correctly).

    Also, htaccess does not change the URL when it error redirects...never has. Reason being that most owners do not want people to know the direct URL to their error pages (and other minor aesthetics--and No, you can't simply add [R,L] on the end of your ErrorDocument to get it to redirect and update the location--which is basically what you want it to do).

    What I would do is create an entrance page to your webmasters area, outside of webmasters, that warns the people they need authentication and offers a link to your tour (plus you can use this area to notify them of outages and other updates). It has a login link to it that simply goes to webmasters. Now in webmasters you have your htaccess with authentication, but you also have a redirect that says 401 to your intro page. You can also then go a step further and add a query string to your 401 redirect and then on your intro page test to see if the query string is there. If the query is there, you can say 'Hi, looks like you failed the test!' or whatever since you know they tried to enter unsuccessfully, if the query string is not there, you know this is their first time trying it out in this session...

    Also, since this isn't PERL/CGI but actually APACHE, I'm moving this to the general server side forum...
    Moderator, Perl/CGI Forum
    shadowstorm.net - subvert society

  • #5
    New to the CF scene
    Join Date
    Aug 2009
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Suggestions

    I know this is old but im sure someone can use this help. I agree with the post above as it is global. Instead of guessing there are tools out there to do this like http://tools-for-webmasters.com and others. I use this for about 90% of my needs.

    Thanks
    Ted
    Last edited by Inigoesdr; 08-23-2009 at 08:10 PM.


  •  

    Posting Permissions

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