TIP: Use Markdown or, <pre> for multi line code blocks / <code> for inline code.
These forums are read-only and for archival purposes only!
Please join our new forums at discourse.kohanaframework.org
Accessing Password Protected Sub Folder in Kohana Directory throws 404 Error
  • Hi guys,

    Currently I'm using Kohana 3.2, and it is installed in my root web directory. I have a sub folder named guide in it as well.

    The structure is like such:

    > application
    > modules
    > systems
    > guide(this needs to be password protected)
        > .htaccess
        > .htpasswd
        > index.html
    > index.php
    > .htaccess

    My kohana .htaccess is:

    # Turn on URL rewriting
    RewriteEngine On
    # Installation directory
    RewriteBase /
    # disable the server signature
    ServerSignature Off
    # disable directory browsing
    Options All -Indexes
    # Protect hidden files from being viewed
    <Files .*>
        Order Deny,Allow
        Deny From All
    # Protect application and system files from being viewed
    RewriteRule ^(?:application|modules|system|archive)\b.* index.php/$0 [L]
    # Allow any files or directories that exist to be displayed directly
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    # Rewrite all other URLs to index.php/URL
    RewriteRule .* index.php/$0 [PT]

    The .htaccess for guide folder is :

    AuthName "Restricted Area" 
    AuthType Basic 
    AuthUserFile example/pathto/.htpasswd
    require valid-user

    When I try to access www.mysite.com/guide/ or www.mysite.com/guide/index.html, it shows me my application 404 screen. This strikes me as weird as these are files do exists.

    When I delete all the Auth stuffs inside the .htaccess file in the guide folder, then it works fine. However, I need it to be password protected.

    Does any one know the solution to this problem?

  • I think the folder "guide" should be placed in the "application / controllers" and there protected.

  • I wronged. Topic is relevant.

  • If you think about the logic sense of this error:

    You are specifying (in the kohana htaccess) that every url rewrites to index.php. Then by going to mysite.com/guide/*, index.php tries to get files from a protected directory..........

  • How can I rewrite kohana-htaccess, to make it work?

    PS I introduce correct login and password throw AuthType Basic

  • Try adding RewriteEngine Off to the guide/.htaccess file

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion