• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Protected file outside of CI application

Hey guys,

I need to implement basic authentication on a file outside of the CI application as I need a page which doesnt load any of the CI configuration. This is for a payment script and so NOTHING can be run when this page opens, only the contents like a standard PHP file.

How would I go about this? I have put a folder alongside the application, system and index.php folders/file and have put my required page in there and put a htaccess basic auth file in there. However, when I go to this folder/page it keeps saying "page cannot be found". I changed my main htacess rewrite file to ignore the new payment folder however it still comes up with the error. If I take the basic auth code out iof the subdirectory it works fine but when I reinstate the code it errors and doesnt work again.

The error I get is the same as if Im trying to access a controller which doesnt exist and is not the standard php error so it seems like its trying to rewrite the url but it shouldnt be!.

Any ideas?

Code below.
AuthName "Admin section"
AuthUserFile "/home/studentc/.htpasswds/public_html/assets/scripts/payment/passwd"
AuthType Basic
require valid-user

So, when that code is in a htaccess file inside the payment subfolder, the page wont display, but when I remove it, the paage does display.

Try adding this to the .htaccess file:
ErrorDocument 401 "Unauthorized Access"
RewriteEngine off

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.