• I’m experiencing a 404 error when I use cPanel to password protect a directory on my site.

    To try to fix the problem, I followed the instructions I found in a another thread and created a file in my public_html directory called “onerror.html” and inserted the following two lines at the top of the .htaccess file in my public_html directory.

    ErrorDocument 401 /home/[account name]/public_html/onerror.html
    ErrorDocument 403 /home/[account name]/public_html/onerror.html

    Unfortunately, that solution, which seems to solve the problem for many people, didn’t work for me.

    Perhaps I’m confused about which .htaccess file to edit and where to place the lines. My WordPress files are in the directory “/wordpress/” in my public_html directory, but I’ve got it set so that the wordpress installation comes up when people go to mysite.com/

    There’s an .htaccess file in both my root public_html directory and in the wordpress directory. Which one should I modify with the “ErrorDocument” lines to avoid the 404? Should I delete or change any of the “rewrite” commands contained in those files?

    Also, should i place the ErrorDocument lines at the very top of the .htaccess file? Or should I place them below the “# BEGIN WordPress” line of the file? Somewhere else?

    It seems like I’ve tried every possible permutation to no avail, but perhaps I’ve missed one. Thanks in advance for any light you can shed on this irritating problem.

Viewing 1 replies (of 1 total)
  • Thread Starter peychaud

    (@peychaud)

    To answer my own question, I think I figured it out. Believe it or not, I just had to delete the “/home/[account name]/public_html/” before onerror.html.

    I would’ve thought the full path would be fine, but I guess not. Anyway, success!

Viewing 1 replies (of 1 total)

The topic ‘404 error when using cPanel password protection’ is closed to new replies.