XtendedView

  • Facebook
  • Pinterest
  • RSS
  • Twitter
  • Home
  • Technology
    • How to
    • News
    • Computer
    • Windows
  • Internet
    • WordPress
    • Web
    • Google
    • Marketing
    • Social Media
  • Gadgets
    • iOS
    • Android
    • Games
  • About
    • Our Team
  • Contact us

Simplest way to move your wp-config.php file to another location in WordPress for security

Author: Tushar Thakur   Last updated on: December 30, 2020    3 Comments  

Protecting your WordPress website from hackers is very essential in day to day world because hackers are increasing now. Thousands of WordPress blogs get hacked daily due to poor security and hosting company issues.

What is wp-config.php?

WordPress is just an operating system very similar our famous window operating system. As in case of window there are many files which required running the windows. Similarly WordPress has many .php files that have their own functions. The wp-config.php file is present in self hosted WordPress site and it is used for storing many confidential parameters like WordPress database name, password, authentication keys etc. first time run of any WordPress installation creates the wp-config.php file.

How to protect your WordPress website by moving the wp-config.php t another secrete location?

 

After discussing too many possibilities of hacking we should have a perfect way to protect your wp-config.php file. The best way to protect the wp-config.php file from hackers is that move it to another location which is not accessible from area outside of cPanel. Because the cpanel is only accessible to the website owner and it will be better for that.

Procedure to change the default location of wp-config.php in WordPress:

First this is that the wp-config.php is located in your main root folder of the hosting under public_html. So in simple language it is yourdomain.com/wp-config.php.

We change its location to a area which is outside of public_html.

  • Inside your cpanel click on file manager and click on home and create another folder outside the public_html area.
  • Then move your original wp-config.php file to this folder. (In this I created a folder name conff) See the image

 move wp-config.php file

  • Create a file name wp-config.php in your pc by using the notepad and paste the following code in it.

move wp-config.php

[php]<!–?php <br ?–>include(‘/home/<strong>YOURUSERNAME</strong>/conff/wp=config.php’);
?>[/php]

In above code replace the YOURUSERNAME with your one. See the image for more detail.

  • Now upload the file in your public_html  at where your original wp-config.php file was.

So now we have successfully changed the default location of your file.

Possible Errors during this method:

  • Fatal error message:

If you are getting this type of error

Fatal error: Call to undefined function wp() in /wp-blog-header.php on line xx

That means you have not written the correct usename and the path to your new location of wp-config.php. So check the path and usename.

 

  • Error saying that there is no wp-config.php file:

If you are getting such error then it means that you have not uploaded that new wp-config.php file to your cpanel public_html .

If you still facing any error feel free to comment here.

Some wordpress related post that you must read:

  • Why I blacklisted in the Akismet Database and How I Recover my email and URL from that
  • How to integrate Related Post in Mystique theme manually – WordPress
  • How to find which site using which wordpress plugin

Filed Under: Wordpress   

More on XtendedView Right Now!

  • Why I blacklisted in the Akismet Database and How I Recover my email and URL from thatWhy I blacklisted in the Akismet Database and How I Recover my email and URL from that

  • Take 2 minutes to enable Breadcrumb for your WordPress website in Google SERPTake 2 minutes to enable Breadcrumb for your WordPress website in Google SERP

  • Edit comment form of your WordPress blog to remove website text boxEdit comment form of your WordPress blog to remove website text box

  • How to Create a Video Gallery on Your WordPress Website

About Tushar Thakur

Tushar is founder of Xtendedview. He love to experiments on different gadgets, software/apps. He is professional blogger and Internet marketer. He is Interested in electronics and computers, Internet technology, Search Engine Optimization, Internet Marketing. Running online business and Blogs

Tushar has written 518 awesome articles for us at XtendedView.

  • Find Tushar On
❮
Why I blacklisted in the Akismet Database and How I Recover my email and URL from that
❯
Take 2 minutes to enable Breadcrumb for your WordPress website in Google SERP

Comments

  1. Norbert Lukacsi says

    at

    Hi there,

    A great basic way of keeping out the automatic hacker bots, is by changing the WordPress table prefix.

    The WordPress table prefix is wp_ by default. You can change this prior to installing WordPress by changing the $table_prefix value in your wp-config.php file.

    If a hacker is able to exploit your website using SQL Injection, this will make it harder for them to guess your table names and quite possibly keep them from doing SQL Injection at all. SQL Injection happens when a developer accepts user input that is directly placed into a SQL Statement and doesn’t properly filter out dangerous characters.

    This can allow an attacker to not only steal data from your database, but also modify and delete it. Make sure you take a good backup before doing this though, and perform it at your own risk.

    Thanks.

    Norbert

    Reply
    • Tushar says

      at

      Thanks for your valuable suggestion Norbert .. 🙂

      Reply
  2. Roi says

    at

    instead of using the ‘home/username/conff/wp-config.php’ that reveals the username

    use ‘../conff/wp-config.php’

    Reply

 Comment Policy

Your words are your own, so be nice and helpful if you can. Please, only use your REAL NAME, not your business name or keywords. Using business name or keywords instead of your real name will lead to the comment being deleted. Anonymous commenting is not allowed either. Limit the amount of links submitted in your comment. We accept clean XHTML in comments, but don't overdo it please. You can wrap code in [lang-name][/lang-name] tags.


Tell us what you're thinking... Cancel reply

If you want a picture to show with your comment, then get Gravatar!

Connect on Facebook

How To Tech

Latest Articles

  • Top 5 Grammar Checkers (Must Have Tools)
  • How to Fix Mouse Lag in Windows 10
  • How To Change MAC Address Of Android With or Without Rooting
  • 8 Best SpeedFan Alternatives for Computers for Windows and Mac

Featured Articles

  • How to Turn off Laptop Screen Manually
  • Best Alternatives for Logic Pro X on Windows 10
  • Digital Ocean Review: Cheapest cloud hosting
  • How to run Android applications on MAC
  • How to remove login password from windows 8
  • How to Play Android games on Windows PC

Trending Topics

  • Android 22
  • Apps 20
  • Automobile 5
  • Blogging 32
  • Business 108
  • Computer 130
  • Education 12
  • Games 13
  • Games 7
  • Google 13
  • How to 75
  • Internet 232
  • Marketing 10
  • Mobile 51
  • Technology 216
  • Windows 16
  • Wordpress 13
  • Some Rights Reserved. Xtendedview | Copyrights 2011-2025 | Site Map | Privacy Policy
  • XtendedView is built on WordPress
  • WordPress Hosting by Bluehost