Change the url path of /sites/default/files/myfile.pdf
Go to this path /admin/config/media/file-system, and change the public file system path.

It might be this, sites/default/files, change it to files.

Then create a writeable folder in your webroot called files.

This could also be done by adding this line in the settings.php file:

$settings['file_public_path'] = 'files';


Just note that this is only for local development if you want to deploy this change you might use the above solution and then export the configuration.