| | #1 |
| WordPress Developer War Room Member Join Date: 2012
Posts: 27
Thanks: 3
Thanked 4 Times in 3 Posts
|
Normally, when clicking on a link to a pdf file, the file opens within the web browser window. To prevent this, your host must support URL rewriting via htaccess. Download the .htaccess file in the root directory of your website. Download it in two copies in two different folders on your computer. You will not modify one of these copies to undo your changes if something goes wrong. If you have no .htaccess file in that directory, simply create one. Create a htaccess.txt file with a text editor like Notepad++. You will only have to upload it to the root directory of your website and rename it .htaccess. In your .htaccess file (or htaccess.txt, depending on your situation), add the following code: Code: <IfModule mod_headers.c> <FilesMatch ".(pdf|zip)$"> ForceType application/octet-stream Header set Content-disposition attachment </FilesMatch> </IfModule> Then upload your file to the root directory of your website, and rename it .htaccess when necessary. Display your website with your browser to make sure everything works well. In case of problems, delete your .htaccess file or replace it with the original version to undo your changes. |
|
WordPress plugins to: => Sell your products => Create your affiliate program => Create your members areas | |
| |
| | #2 |
| WordPress Developer War Room Member Join Date: 2012
Posts: 27
Thanks: 3
Thanked 4 Times in 3 Posts
|
But I've no problem, jaasmit. My post is a solution. |
|
WordPress plugins to: => Sell your products => Create your affiliate program => Create your members areas | |
| |
| | #3 |
| Marketing 101 :) Join Date: 2011 Location: London, UK
Posts: 314
Thanks: 19
Thanked 48 Times in 45 Posts
|
Jeremy, thank you for your post, this is very helpful/informative. thanks
|
| |
| | #4 |
| VIP Warrior War Room Member Join Date: 2006 Location: , , USA.
Posts: 1,795
Thanks: 70
Thanked 287 Times in 259 Posts
|
Why do you want to mess up how the user wants to display pdf files on their system?
|
| |
|
| Bookmarks |
| Tags |
| browser, files, opening, pdf, prevent, web |
| |