1

Not sure how to properly title this problem (my apologies). Recently my web hoster has upgraded from Apache to Litespeed. In doing so this has rendered my custom, “401 error page/unauthorized login” to not load properly.

Here is current .htaccess file stored in my “public_html” folder:

RewriteEngine on

<FilesMatch "\.(htm|html|css|js|php|gif|jpe?g)$">
Require all granted
</FilesMatch>

ErrorDocument 400 /.error400.php
ErrorDocument 401 /.error401.php
ErrorDocument 403 /.error403.php
ErrorDocument 404 /.error404.php

AuthType Basic
AuthName "Protected 'public_html'"
AuthUserFile "/home/dac/.htpasswds/public_html/passwd"
Require valid-user

Now when my error page loads, the only elements that are functioning are the hyperlinks. The 4 image files along with the .css file are not loading.

What my 401 error page looks like after an unsuccessful login attempt:

My custom 401 error page

Now in troubleshooting this last time, I know I had to alter the following code below in my .htaccess file:

<FilesMatch "\.(htm|html|css|js|php|gif|jpe?g)$">
Require all granted
</FilesMatch>

I know I need something like <FilesMatch> to allow authentication and allow public access to this document. But with the upgrade from Apache to Litespeed I’m stuck. Any help on this would be greatly appreciated!

Thanks,

-X

  • Do you have any other directives in your `.htaccess` file? You've enabled the rewrite engine (`RewriteEngine on`) for some reason? What HTTP response are the images and CSS file getting? – MrWhite Nov 30 '20 at 23:11
  • What files are you actually wanting to protect? – MrWhite Dec 01 '20 at 00:25
  • I am protecting the rest of my files on my “public_html” directory. You had helped me before with my images and css file not displaying properly here: https://stackoverflow.com/questions/64862309/cpanel-custom-401-error-page-not-displaying/64863594?noredirect=1#comment114680381_64863594 Everything has remained the same, just that the webhoster switched from Apache to Litespeed. Now everything is back to square one...not displaying. – Brandon Humphrey Dec 01 '20 at 01:48
  • "I am protecting the rest of my files on my “public_html” directory." - Yes, but which files? Are there many different types? It's just that you are permitting unrestricted to _all_ "normal" website files (PHP, JS, CSS, images), it might be better to restrict access to only the files that need to be protected. (?) – MrWhite Dec 01 '20 at 09:53
  • The image below are the only files in the "public_html" the rest are file folders containing images: [Screenshot - public_html](https://ibb.co/Zmwk49f) – Brandon Humphrey Dec 01 '20 at 20:31

0 Answers0