Can’t Access Protected Files After Migrating to a New Server

By: Zaid Francis | Asked: 08/07/2024
ForumsCategory: General questionsCan’t Access Protected Files After Migrating to a New Server
Zaid FrancisZaid Francis asked 4 months ago

Hello all,

I have an issue with my protected uploads. I’m unable to access the old uploads after migrating my cPanel account to a new server. When I open any file link on the new server, I get this message:

“Oops! That file no longer exists.”

I have a custom location for these uploads:

add_filter('frm_upload_folder', 'frm_custom_upload', 10, 2);
function frm_custom_upload($folder, $atts) {
    $form_id = 'form_'.$atts['form_id'];
    $year = date("Y");
    $month = date("m");
    $folder = '../../wp-content/uploads/formidable/newpath/'.$form_id.'/'.$year.'/'.$month.'/';
    return $folder;
} 

I checked all the original files, and they all exist where they are supposed to be.

I can open the files with a direct link. However, when I try to open them from the encrypted link (e.g., https://domain.com/aWQ6MTE5Njgwf.....)

I get the error mentioned above. I checked everything, including permissions, and all seems to be okay.

One thing to mention is that my old server account home directory was /home/, while the new one is /home2/. However, when I checked the paths in the database, there is no /home/ in the file paths.

Any help is really appreciated.

Thank you.

1 Answers
Zaid FrancisZaid Francis answered 4 months ago

I found the solution and its not related to the home directory path, just by adding

define( 'UPLOADS', 'wp-content/uploads' );
before this line
require_once(ABSPATH . 'wp-settings.php');

to the wp-config.php file.

Making the Best WordPress Plugin even better - Together

Take on bigger projects with confidence knowing you have access to an entire community of Formidable Experts and Professionals who have your back when the going gets tough. You got this!
Join the community
crossarrow-right