WordPress.org

Forums

HotLink Protection: which folder to install .htaccess file? (5 posts)

  1. richards1052
    Member
    Posted 10 years ago #

    I enabled HotLink Protection on my cPanel to prevent people fr. linking directly to my hosted images. I notice that by default it added the new data into an .htaccess file located in my public_html folder. But my blog is installed in a subdirectory.

    I just checked my last 300 referrals & there are still images being directly linked to. So I'm guessing that the HotLink rules should be in the .htaccess file located in my subdirectory. Is that so?

    If yes, I already have mod_rewrite rules in that .htaccess file that govern WP related permalink redirection. So I don't want to mess with those rules. Should I insert the HotLink rules after the WordPress 'End' portion of the file?

  2. Jonathan Dingman
    Member
    Posted 10 years ago #

    It should be in the root directory of your website if you want to hotlink things from there out, but if you're only worried about things under your WP install, then you can put it there.

    I personally put my .htaccess at my public_html/ directory.

  3. richards1052
    Member
    Posted 10 years ago #

    cPanel installed the rules in my root directory (public_html) but it's not working there as images & song files linked to my server are still displaying at external sites. So I think the only way I'm going to get this to work is by adding them to .htaccess in my subdirectory folder.

    I already have WP related rules enclosed within:

    # BEGIN WordPress...# END WordPress

    Should I add rules regarding Hotlink Protection AFTER the "# END WordPress" section? As I said above, I don't want to mess up those wp-related rules.

  4. richards1052
    Member
    Posted 10 years ago #

    I added the Hotlink Protection rules to my subdirectory & now they're working (& hopefully not messing up anything else in my .htaccess file!).

    BTW, for others using HotLink Protection...which pg. do you direct people to who click on yr. images/song files in external sites? Do you send them to your home pg. or to an error pg.? If the latter, what error msg. do you use? I wonder if I should create a special msg. for these folks?

  5. thugparlay
    Member
    Posted 9 years ago #

    I am dwelling on that same problem right now. The difference with mine is that WordPress is installed in my root directory, so the .htaccess file already had WordPress permissions on it.

    I wanted to add hotlinking protection also, but I noticed when I open it up in CPanel I can see some of the WordPress permissions in the textfields already. I added the hotlink protection anyway and now the Permalink structure is screwed up.

    I will try and add the hotlink protection permissions after WordPress' and see what happens.

    -Richards1052
    I usually send them to my home page so they can look around a bit and find what they're looking for :)

Topic Closed

This topic has been closed to new replies.

About this Topic