Get Paid to Participate - up to $1 per post!     Twitter     Facebook
Hosting Discussion
 

Hosting Discussion > Web Hosting Forums > Hardware and Server Configuration > Password Protection, .htaccess and ErrorDocument Commands
forgot password?



FORUM SUPPORTERS:

Reply


Old
  Post #1 (permalink)   01-07-2019, 07:59 PM
HD Addict
 
Join Date: Aug 2015
Location: Omaha, Nebraska
Posts: 235

Status: bigredseo is offline
Hey guys,

This has frustrated me to no end for a few weeks so I thought I'd post here just in case someone else needs the help!

I moved accounts from one server to another, and ever since doing it, when I use the Password Protection inside cPanel to protect the public_html folder, it wouldn't work 100%. The password prompt would not come up, but the page would show the HTML for the site, just no CSS styling. Certainly not secure!

After talking with the hosting company, they told me that I couldn't password protect the public_html folder, only subfolders... welllll.. that's not true as I've been doing it for 15 years and various servers!

This really caused issues with WordPress and the RewriteRule
Code:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
Essentially the "RewriteRule . /index.php [L]" would fail as it wanted to be "RewriteRule ./ /index.php [L]"

Of course, if you make ANY update in WordPress to the settings, permalinks or even the sitename, it resets this section of code in the .htaccess file (anything between the BEGIN/END Wordpress segments).

I finally found the issue - ErrorDocument

The server that I moved to did not have a 401 defined, thus the password would not protect.

To resolve it, I added "ErrorDocument 401 default" to the top of the .htaccess file and everything popped up and worked.

To resolve this on the server level, I created an .htaccess file for the /home folder, and this now works for every client, and still allows them to create their own ErrorDocument if they wanted.

I believe this can also be set under an Apache file loading the server, but this at least allowed me to get back to work in a fairly quick manner.

Do you have a better way to implement the ErrorDocument 401 definition?
__________________
Conor Treacy
Big Red SEO - Omaha, NE
ConorTreacy.com <- That's Me! ;)
 
 
The Following User Says Thank You to bigredseo For This Useful Post:
Artashes (01-08-2019)
Reply

Thread Tools

New Post New Post   Old Post Old Post
Posting Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Sponsored By: