Welcome Guest, Not a member yet? Register   Sign In
Protected file outside of CI application
#1

[eluser]JanDoToDo[/eluser]
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.
Code:
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.
#2

[eluser]WanWizard[/eluser]
Try adding this to the .htaccess file:
Code:
ErrorDocument 401 "Unauthorized Access"
RewriteEngine off




Theme © iAndrew 2016 - Forum software by © MyBB