.htaccess and WHM Apache Include Editor has No Effect

#1
Hello,

I recently upgraded from Apache to Litespeed, and I have multiple directives in the "Apache Includes Editor" in the WHM interface under the "Pre Main Include" for "All Versions."

Examples of these directives include:
Apache config:
# Force HTTPS.
<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{HTTPS} !=on
    RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
</IfModule>

# Prevent wp-config.php from being accessed.
<Files "wp-config.php">
    Require all denied
</Files>
 
<Directory ~ "(\/home\/.*\/public_html\/.*(wp-content\/uploads))">
    AllowOverride None
    <Files ~ "\.ph(?:p[345]?|t|tml)$">
        Require all denied
    </Files>
</Directory>
These directives no longer work when using Litespeed. How do I get them to work? I also attempted adding them to a .htaccess file within the public_html folder of a user (I removed the "Directory" wrapper), and they still didn't have any effect.

Thanks!

Jake
 
Last edited:

NiteWave

Administrator
#2
I did a test on one server
WHM Home »Service Configuration »Apache Configuration »Include Editor -> "Pre Main Include" for "All Versions."
added only
Code:
<Files "wp-config.php">
    Require all denied
</Files>
and tested with
Code:
#curl -I test.domain.com/wp-config.php
HTTP/1.1 403 Forbidden
Connection: Keep-Alive
Content-Type: text/html
Date: Tue, 20 Aug 2019 09:09:41 GMT
Server: LiteSpeed
just works as expected.
also put above rule in .htaccess, all works.
 
Top