• Resolved nigelrs

    (@nigelrs)


    Hello,

    I have uploaded my files to /lucid-dreams.info/wp-content/media/*****

    The download files on the product are listed to be found in this directory.

    I have selected the settings on WooCommerce to > Force Download

    I have NOT selected Allow To Use As Redirect Mode NOR Append A Unique String

    My server is Apache Litespeed.

    When I place a test order, go to my download links, I get a “File not found Go to shop”

    The htaccess for wp-content has no active instruction, nor does the media folder within wp-content.

    I still get a denial. Therefore it looks as though there is a permission problem. However, when I go to settings and select Redirect and Append a new string, it does open the file, but in the browser and not as a Forced Download.

    I am confused, I just want a simple forced download with a hidden string.

    Please advise.

    The page I need help with: [log in to see the link]

Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Support lionel.a11n

    (@lioneldaniel)

    Hello @nigelrs,

    Sorry you’re having trouble with the ‘Force Downloads’ option!

    You can also try to contact your host to enable the secure redirect method – X-Accel-Redirect/X-Sendfile (this is different than the ‘Redirect only’ method). From the documentation:

    With [X-Accel-Redirect/X-Sendfile] downloads are handled by the server (nginx/apache). This method requires the X-Accel-Redirect/X-Sendfile module to be installed and enabled on the server. Confirm with your web host that one of these modules is installed before using this method. It’s the most reliable method because the file is served directly to the customer and gives you the best performance. Files are also protected by an .htaccess file, making it secure.

    Regarding why the Redirect method works but the Force Downloads does not, you can find out if this is WooCommerce causing the issue or a conflict with your theme/a plugin. After backing up your site try disabling your theme, then your plugins, and placing test orders at each step to see if those links work. Click here for how to test for conflicts.

    If you find that the issue presents itself when on a default theme with no plugins except WooCommerce activated, contact your host for help troubleshooting. Provide them the download links that are produced which result in a ‘File not found’ error, so they can see if there is a setting on the server which may make those secure download links fail. If they find the issue is with how the links are formed, please let us know.

    We look forward to hearing back from you, and if you have any further questions or details please include those in your reply. Thanks!

    Hi @nigelrs

    We’ve not heard back from you in a while, so I’m marking this thread as resolved. If you have further questions, please feel free to open a new topic.

    Thread Starter nigelrs

    (@nigelrs)

    Hello,

    I have tried that and it failed.

    Strangely enough, when I go into the Products > Downloadable products I have ‘Force downloads’ set. I have Grant access to downloadable products after payment selected and append a unique string for security selected.

    When on top of that I have ‘allow using redirect mode’ selected; the file doesn’t download, but opens in the browser (any browser, tried 2 and incognito).

    When I deselect that box, I get a file not found. I reselect and it shows in browser, I deselect and it I get a file not found etc.

    I do have another domain on the same server, with access to the same server configuration. I have force downloads set and they download. That is v5.5.1 and the one I am struggling with is v 5.5.2.

    Both of the ‘download’ files have the https://domain.com/?download_file=****&order=wc_order_morecode_email address_morecode

    Mirko P.

    (@rainfallnixfig)

    Hi @nigelrs,

    Most likely something is happening on your server that doesn’t actually permit this download method. To fix it, you can talk to your hosting company and see if they can check further into this – or you can switch to the Redirect Only download method in your settings.

    You’ll notice that the Redirect Only method is labeled as “insecure.” To clarify, it’s insecure because it makes it so that anyone with the file URL for a download associated with a product can use that URL to access that file even if they haven’t purchased the product that grants them access. The other methods do a better job of preventing this. In that case, you might want to use a download manager to add a level of security and try some of these: https://www.ads-software.com/plugins/search/download+manager/.

    Before doing any changes you should always ensure that you have a backup of your site in case anything goes wrong. More info at Backing up WordPress content.

    Let us know how it goes.

    Thread Starter nigelrs

    (@nigelrs)

    I have turned on the element that the user must be logged in to access a download, not an ideal situation.

    I am not sure about the server being a part of the issue per se. I have another ecommerce site on it and the download files are working fine, it is just this site only opens a download in a browser.

    I will look at the download manager suggestion though.

    Thank you

    Thread Starter nigelrs

    (@nigelrs)

    Thank you, just as an updated, I have put two files in the WP > wp-content > uploads folder. A .png downloaded and a .pdf didn’t download but opened in the browser.

    There is nothing in the .htaccess file that is within the > uploads folder about files that are permitted/restricted?

    This is to give some feedback to the post. I will try and look for a solution to this problem.

    Thread Starter nigelrs

    (@nigelrs)

    The other update is WooCommerce creates a .htaccess in the folder woocommerce_upload folder that has a ‘deny to all’ line in it.

    So the folder generated by woocommerce is putting a .htaccess in it that stops access to the uploaded files?

    There is some logic somewhere, but I cannot see it.

    When I disable that line of code (#) it, the file then opens in the browser, when I put a file within a subfolder of woocommerce_upload, then that file cannot be found to download (even thought it is clearly there).

    It’s all very bizarre, the configuration of it.

    Thread Starter nigelrs

    (@nigelrs)

    ** SOLVED **

    Added to .htaccess in the woocommerce_uploads folder:

    <FilesMatch “\.(mov|mp3|jpg|pdf|mp4|avi|wmv)$”>
    ForceType application/octet-stream
    Header set Content-Disposition attachment
    </FilesMatch>

    Plugin Support Shohan Hossain Nabil – a11n

    (@sohanhossain)

    Hello @nigelrs,

    Great! Good to know that you have managed to solve the problem by yourself, well done!

    I’m going to mark this as resolved – feel free to submit a new thread if you need further assistance.

    Cheers.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘WooCommerce Force Downloads Not Working’ is closed to new replies.