Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    May 2017
    Posts
    54
    Thanks
    25
    Thanked 1 Time in 1 Post

    .htaccess/.htpasswd gives 401 Unauthorized Error on iPhone

    After working all night I discovered that .htaccess/.htpasswd gives an 401 Unauthorized Error on iPhone. This is a known issue but I can't find a working solution. I used my hosting companies cPanel password protection and this is the .htaccess file:

    Code:
    AuthType Basic
    AuthName "BMCC Presentation"
    AuthUserFile "/home/s0rs3bq2y1gs/.htpasswds/public_html/heritagecapitalconsulting/slideshow/passwd"
    require valid-user
    It works on every browser platform that I have tested including my Android phone. This is the link that the iPhone can't handle:

    https://heritagecapitalconsulting.com/slideshow.html

    Does anyone have any experience with this type of problem? I know I need something in my .htaccess file to allow iPhone users to get into this folder by having to enter a username and password.

    Maria

  2. #2

  3. #3
    New Coder
    Join Date
    May 2017
    Posts
    54
    Thanks
    25
    Thanked 1 Time in 1 Post
    Yes with a valid user and password they can download the PDF. Turns out it was a "known" issue with iPhones and the .htaccess file not allowing iPhone users to get into the password protected folder. I had to force the https link. Here is the code I used just in case anyone needs it.

    Code:
    {RewriteCond %{HTTPS} !on
    RewriteCond %{THE_REQUEST} ^(GET|HEAD)\ ([^\ ]+)
    RewriteRule ^ https://%{HTTP_HOST}%2 [L,R=301]
    
    ErrorDocument 401 "Unauthorized"
    
    AuthType Basic
    AuthName "BMCC Presentation"
    AuthUserFile "/home/s0rs3bq2y1gs/.htpasswds/public_html/heritagecapitalconsulting/slideshow/passwd"
    require valid-user
    I changed the error code to simply "Unauthorized" as the 401 error code verbiage was too confusing to the common user.
    Last edited by mariafgp; May 28th, 2018 at 11:27 AM.


 

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •