i moved wp-config.php outside of public html and this broke my website

I moved it back and the website started working again. I tried moving wp-config to secure my wordpress site

here is what i did:

  1. created another file config.php
  2. downloaded wp-config and copied all the code in it to config.php
  3. cleaned all the code in wp-config.php and wrote this:
?php
include('domains/mydomain.com/conf/config.php');

i wrote my real domain name instead of mydomain.com

  1. uploaded config.php to /domains/mydomain.com/conf

  2. uploaded wp-config.php to /domains/mydomain.com/public_html

before moving wp-config.php, i modified .htaccess to forbid public access to wp-config.php

what did i do wrong while moving wp-config.php ? i also tried uploading config.php without conf folder, to /domains/mydomain.com/ but the result is the same.

is .htaccess method enough or i still need to move wp-config.php outside of the public folder?

Topic security Wordpress

Category Web

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.