• Resolved hollak

    (@hollak)


    Hello WordPress geniuses,

    I want to offer my vCard for download on my blog by clicking on an icon. Unfortunately when you click on the icon it offers up the simple txt of the vCard instead of offering a download window like other files (.pdf or .zip).

    I’ve read that I can edit my .htaccess file with one line of code in order to instruct the server to treat the .vcf file like a .zip file. Here is the code I have found to add to the .htaccess file:

    AddType application/octet-stream vcf

    Trouble is, I have no idea where in the .htaccess file to add this one line of code without breaking anything.

    My .htaccess code current reads:

    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>

    # END WordPress

    Any help would be greatly appreciated. Where would I add the one line of code?

Viewing 9 replies - 1 through 9 (of 9 total)
  • moshu

    (@moshu)

    Anything else should always be outside of the
    # BEGIN WordPress

    # END WordPress
    portion!

    Thread Starter hollak

    (@hollak)

    @ moshu:

    Thanks for the reply. Lemme go try it (with fingers crossed).

    If this works, I will be sure to close out the question as resolved.

    Thread Starter hollak

    (@hollak)

    Well, the good news is that the one line of code added to my .htaccess file didn’t break anything (thanks moshu).

    Unfortunately, the code:

    AddType application/octet-stream vcf

    doesn’t fix my problem of wanting a .vcf file treated like a .pdf file forcing a download window to appear. It still just goes to the simple text of a .vcf file in a browser window.

    Anyone have a solution?

    Moderator Samuel Wood (Otto)

    (@otto42)

    www.remarpro.com Admin

    Make sure you put it at the top of the .htaccess file. Dunno if it will work at the bottom.

    Thread Starter hollak

    (@hollak)

    @otto42:

    Thank you. I’ll try that.

    I can’t be the only person to want to offer up a .vcf inside of a WordPress page. Somebody has this figured out.

    Thank you, off to give the line of code a try at the top.

    Thread Starter hollak

    (@hollak)

    @ Otto42 & moshu:

    A big thank you to both of you.

    Moving the line of code to the top of the .htaccess file worked. I had it at the bottom. Thanks guys.

    So if anyone else runs across this problem, here is the .htaccess that forced the .vcf file to be treated like a .pdf and open a download window:

    AddType application/octet-stream vcf

    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>

    # END WordPress

    Thanks to everyone, this was just what I was looking for and incredibly helpful!

    hollak,

    I am pretty new to wordpress so apologies in advance if this is a simple question. Can you let me know where you hosted your vcf file for this to function? did you just embed a vcf image in a page with an href to the location to get this to work?

    Thanks

    @feargall that code should work with any vcf file at the same level as the .htaccess file or any folder or or subfolder within that directory.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘htaccess edit for vcf / vcard downloading’ is closed to new replies.