Backing up wp-config.php if it is above public_html folder

UpdraftPlus Home Forums Paid support forum – UpdraftPlus backup plugin Backing up wp-config.php if it is above public_html folder

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #18088
    Andrew
    Participant

    Hi,

    One of my security measures on WordPress is to move the wp-config.php file up one folder level on the server, above the public html folder.

    How can I get UpdraftPlus to back it up? Entering the full path to the file in the “Any other directory on your server that you wish to back up” options didn’t work, since Updraft is looking for a directory, not a file, and kicks out an error.

    /nfs/c04/h06/mnt/123456/domains/domainname.com/wp-config.php

    (my WordPress install is located here: /nfs/c04/h06/mnt/123456/domains/domainname.com/html/ )

    Thanks,
    Andrew

    #18815
    udadmin
    Keymaster

    Hi Andrew,

    You could enter the path to the directory, and then add the list of other entities in that directory as things to exclude from the backup. i.e. back up /nfs/c04/h06/mnt/123456/domains/domainname.com/wp-config.php and type in “html” in the list of things to exclude.

    Note, though, that unless your wp-config.php contains something more than just your MySQL configuration, then you may not need to back it up.

    David

    #18822
    Andrew
    Participant

    Which “exclude” field should I use? There are exclusion fields for Uploads, WordPress Core, and within wp-content… but all of those would be below the /html/ directory…

    (And I do customize wp-config.php – usually to lock out the WordPress File Editor and increase WP Memory Limits… Not mission critical, but would be nice to have in the backup sets so it is faster/easier to recover from a major catastrophe.)

    Thanks again,
    Andrew

    #18823
    udadmin
    Keymaster

    Hi Andrew,

    Ah, you’re right – there isn’t an exclude field for it.

    I’ve just tweaked the code so that the next release of UpdraftPlus (due in around a fortnight) will allow you to specify single files for backup, and then you’ll be able to add the full path to the file.

    Best wishes,
    David

    #18824
    Andrew
    Participant

    Excellent – thanks David! :)

    One other thought – what about tweaking UpDraft to look for wp-config.php one level above the WordPress installation, if the file doesn’t exist in the default location? Considering that it’s recommended in the Codex, it seems like a good thing to just include automatically with a backup.

    https://codex.wordpress.org/Hardening_WordPress#Securing_wp-config.php

    Thanks,
    Andrew

Viewing 5 posts - 1 through 5 (of 5 total)
  • The topic ‘Backing up wp-config.php if it is above public_html folder’ is closed to new replies.