Question

How to hide .user.ini in my OpenLiteSpeed server to use Wordfence in Wordpress?

Posted December 18, 2020 428 views
WordPressOpenLiteSpeed WordPress 1-Click

Hello, i just got a fresh install of WordPress with the one click install from the marketplace and I installed Wordfence and it recommends me to hide user.ini because is public and anybody can have access to it.

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
Submit an Answer
2 answers

Hi,

Method 1:
If you don’t need the user.ini/.user.ini file, can simply remove the file.

Method 2:
Use the rewrite rule to block any file with extension .ini and .log,

RewriteRule ^.*\.(log|ini)$ - [F,L]

Reload the webserver,

systemctl restart lsws

Best,
Eric

  • Hello, I don’t know if I will need that file later on. What is this file for?

    How can I use the rewrite rule? I’m a complete beginner in servers, if you could guide me trough the commands to achieve that it will be much appreciated.

    Thanks for your answer.

    • Hi,

      Okay, please try running the following commands one time and it should works,

      sed -i '1iRewriteRule ^.*\\.(log|ini)$ - [F,L]' /var/www/html/.htaccess
      

      and

      systemctl restart lsws
      

      Let us know if it works.

      Best,
      Eric

It worked! Now I don’t have that notification anymore. Thanks.