user1286956
user1286956

Reputation: 299

.htaccess can't access my index

I am trying to limit which files and/or subfolders can be accessed within a directory through .htaccess. My issue is that once I set up "Deny All" but "Allow" index.php to be accessed, when I simply enter site.com/folder I get a 403 error instead of reaching index.php. How can I restore the default redirect to index without messing the rules in my .htaccess file!?

<Files ~ "^.*">

    #Deny Access to Everything
    Order Allow,Deny 
        Deny from all 

</Files>

<Files ~ "^index\.php|^changepass\.php|^wr\.php|^wrs\.php|css|js|.*\.png|.*\.jpg|.*\.pdf">

    #Allow Exceptions
    Order Deny,Allow
        Allow from all

</Files>

<Files ~ "^splif\.php">

    #Allow Specific Exception
    Order Deny,Allow
        Allow from all

    #Request Authentication 
    AuthUserFile /home/path/secret/.htpasswd
    AuthGroupFile /dev/null
    AuthName EnterPassword
    AuthType Basic
        require user admin

</Files>

Upvotes: 0

Views: 635

Answers (1)

user1286956
user1286956

Reputation: 299

Well, my solution was to make some extra .htaccess files in the subfolders with only "Order Allow,Deny Deny from all" and modify Files ~ "^.*" into Files ~ "php". This way I block all other .php I don't want people to snoop into and leave the images, javascript and other format files accessible only by name!

Upvotes: 1

Related Questions