how to secure woocommerce downloadable files - wordpress

As the title states I have a question about digital downloadable products through woocommerce. I am new to web development and wordpress so go easy on me. I am trying to add a downloadable product where you can't access the file by direct url. I have set the download type to force download to prevent link sharing but found that I can still access the purchasable files by typing in the direct path Example:
example.com/wp-content/uploads/woocommerce_uploads/2015/06/examplefile.pdf
I have done quite a bit of research but have come up with very few results. One of the only things that I have found is that I should move the downloadable files outside of the root directory. I have attempted to do this but then the download links no longer work. Instead of doing a forced download like normal it redirects to to a page like
example.com/home/user/public_html/home/user/downloads/examplefile.pdf
So I am thinking woocommerce must not be friendly with the files outside the root directory. All in all I am out of ideas of what else to try. Any help or suggestions of how to make this work (having files outside root directory) or other solutions would be greatly appreciated.

If you create a folder outside the public_html directory and upload the files here, you will be safe.
You can find detailed explanations about this topic and how to copy the links of uploaded files in this blog post.

You can add a .htaccess file in the woocommerce_uploads folder with
deny from all

Related

Wordpress downloadable files redirect to file not found

I have a website with digital downloadable products. Sometimes the links just don't work and customers see file not found. Go to shop
I have tried switching from force downloads to redirect only. This method helped for one product only
I wonder if there is any way to fix it
You need to check some steps to resolve this issue. Such as
Check the file path
Check file permissions
Check the download link
Use a file hosting service
Monitor your website logs
i hope this checklist might helpful. Thank u

Linking to a file on server in Wordpress

I hava a website in Wordpress. Let's say is installed on a domain www.something.com.
I know how to get to individual files, but is it possible to make a link to a file, so that the URL would be: www.something.com/pdf/article1.pdf?
Yes ofcus, Simply put in the link like so, in your html/text
Download here
to refer to the file, and make sure u have the pdf folder created in your root directory.
Good luck.

Putting a custom directory inside wordpress

I have a simple HTML microsite, which I want to put inside my wordpress website. For example: Wordpress website is: abc.com
I want to put my microsite inside this wordpress site. So URL becomes:
abc.com/microsite/
But, wordpress treats any url as its own. How can put "abc.com/microsite/" urls to Wordpress Ignore list. So that any pages inside microsite folder executes independently.
just put you folder 'microsite' in root(Where you find wp-admin,wp-content and wp-include folder). and
you are able to access the folder
"abc.com/microsite/ by this url
If you are still having issues with accessing the subfolder, try renaming the .htaccess to .htaccess-bak in order for WordPress to regenerate the file again. Understand that your website might temporarily go down.
I've found this solution to help in some cases, but I don't know exactly why, ergo I am not sure it will work. And if you feel uncomfortable editing the .htaccess file I suggest you learn more about it (as should I). It is a very powerful file and WordPress uses it a good deal.
P.S. The file is located in the same folder, WordPress' root folder where you find /wp-admin/, /wp-content/, etc. It is hidden by some hosting providers, but I've always been able to find them through FTP with the hosting companies I've used before.

Short permanent file URL in WordPress

A complete WP newbie here...
I want to upload file to the WP site, so users can download it.
From what I see, when uploading to WP, the file gets a long URL which includes wp-content, date, etc. I want it to have a short, permanent URL, ie:
www.mysite.com/setup/setup.exe
How can I do that?
Please note this question applies to only one or two files on my site, the rest of the files (images, mainly) can continue use the same URL scheme.
Thanks!
Create a folder in your ftp where the site is hosted, call it Download then your file will be available at: www.mysite.com/download/file.me

Updating a Favicon and finding the root directory. Did not install

I was given administrative access to a blog and have been asked to update the favicon. I watched a video and I have done all the steps needed to generate a favicon from an image. The only problem that I have is using FTP to transfer the image to my root directory. I understand where the root directory is theoretically found but the problem is that I didn't install Wordpress. All I was given was administrative access. I'm assuming that the person who created the site has the files on his computer, so only he can update the root directory and place the favicon in it. However, common sense tells me that this assumption has to be wrong or is it?
Should I be asking the site's creator to copy the files to me? This doesn't seem right at all. Thanks for any help.
If you have an admin access to a live blog then the wordpress files are correctly installed. Check for folders starting by the prefix wp- like for instance wp-content in your FTP directories. If you can't find any then you are not on the correct FTP server. Now suppose you are on the right FTP server. Put your .ico image in the /wp-content/uploads folder.
Once done to display the favicon go to your admin panel in the menu on the left choose the option Appearance or Display (I don't know the exact word since I am using it in French but it should be something related to the look of your blog) Then go to the editor option and select the file header.php to edit.
And add the following line of code right after the code <head>:
<link rel="shortcut icon" href="/wp-content/uploads/favicon-filename.ico">
Save the changes and voilĂ .

Resources