Password protect a folder in CI |
Hi, i'm struggling coz i'd need to password protect a folder inside public_html on my server, it's to allow the customer to access stats from the browser without giving access to cpanel.
But CI installation keeps on giving a 404 all the time i try to access the folder after i password protect it via htaccess. Any suggestion. Thanks a lot in advance!
Are you sure is a folder and not a CI controller? If the answer is yes, show me your .htaccess that can be found in your public_html directory. If the answer is no, then you can't password protect a controller with .htaccess...
Website: http://avenir.ro
Hi, for sure i'm talking about a folder.
My .htaccess looks like this.. <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteCond %{HTTP_HOST} ^mysite\.com RewriteRule (.*) http://www.mysite.com/$1 [R=301,L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php?/$1 [L] </IfModule>
Show the dir structure of public_html and tell us which directory it is you're trying to protect.
Is it something like this? -/public_html --/application (CI) --/dir-to-protect --index.php (CI's index)
Hi, i've kept application and system folders out of public_html to be safer.
As you guessed this is what i got: -/public_html --/img --/css --/js --/dir-to-protect/file-to-protect.php --index.php (CI's index) --and of course .htaccess robots.txt sitemap.xml etc.. ( to let you know i'm a good boy ![]() Thanks
Hi,
as soon as i password protect a directory in my public_html folder, a .htaccess is auto generated inside the directoy eg: -/public_html --/dir_to_protect --/dir_to_protect/.htaccess This is what inside the file: AuthType Basic AuthName "folder_to_protect" AuthUserFile "/home/user/.htpasswds/public_html/folder_to_protect/passwd" require valid-user |
Welcome Guest, Not a member yet? Register Sign In |