zied123456
zied123456

Reputation: 255

Htaccess - 403 status code when executing PHP file

I have created a directory named synchro under C:/xampp/htdocs/ and I have added a PHP script test.php that contains a webservice and I have generated a passwords file.

And to secure the folder I have added .htaccess file that contains:

Options +Indexes
AuthUserFile "C:/xampp/htdocs/synchro/passwords"
AuthName "Authentication required"
AuthType Basic
Require valid-user 

But when I try to execute the PHP file

localhost/synchro/test.php

After entring login and password I got Error 403 How can I fix it?

Upvotes: 0

Views: 91

Answers (1)

Joe
Joe

Reputation: 4917

You need to remove the speech marks from around AuthUserFile. It should look like this:

AuthUserFile /xampp/htdocs/synchro/passwords

You then need a file called .htpasswd. This will be where you create your login and password.

For example:

Admin:gl0IiOirI2n6M

So your AuthUserFile will look like this:

AuthUserFile /xampp/htdocs/synchro/.htpasswd

Upvotes: 1

Related Questions