[resolved] [Plugin: BPS Security] Editing .htaccess file to Protect hotlinking (6 posts)

  1. icing
    Posted 3 years ago #

    I am trying to add the following code to secure.htaccess from Edit/Upload/Download Tab of the plugin.

    RewriteEngine on
    RewriteCond %{HTTP_REFERER} !^$
    RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?http://sitename.in [NC]
    RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?http://sitename2.in [NC]
    RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?http://www.sitename.in [NC]
    RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?http://www.sitename2.in [NC]
    RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?http://sitename3.in/ [NC]
    RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?http://www.sitename3.in/ [NC]
    RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?http://sitename4.in/ [NC]
    RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?http://www.sitename4.in/ [NC]
    RewriteRule \.(jpg|jpeg|png|gif)$ http://i.imgur.com/hX1mb.gif [NC,R,L]

    But when I click on update, I end up on a 404 page.

    I also have Better WP Security, tried disabling it. Still the same.

    .htaccess has 644 permission when I checked it under Security Status Tab.


  2. AITpro
    Posted 3 years ago #

    404 errors are a common problem with the Better WP Security plugin. I am not sure exactly why that plugin causes these problems. Some day i will test that plugin.

    The .htaccess code you have posted here is not valid. I found this neat automatic hotlink protection .htaccess code generator here >>> http://www.htaccesstools.com/hotlink-protection/

    This is code that it created

    RewriteEngine on
    RewriteCond %{HTTP_REFERER} !^$
    RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?ait-pro.com [NC]
    RewriteRule \.(jpg|jpeg|png|gif)$ - [NC,F,L]
  3. icing
    Posted 3 years ago #

    Thanks AITpro for replying here. I have corrected the above code using the website you have given. Still when I click Update File, it doesn't get updated and returns a 404(Nothing Found, Embarassing of page twentyeleven theme). I have deactivated all other plugins for the time being.

    Is there another way to edit .htaccess file with which bulletproof security plugin is fine with?

    Please let me know.


  4. icing
    Posted 3 years ago #

    I have fixed the code and manually uploaded secure.htaccess file and now image hotlink protection is working.

    Though, I couldn't update from within the plugin. Something, you might want to look into.

    Thanks AIT for your help.
    Topic Resolved

  5. AITpro
    Posted 3 years ago #

    Have you used AutoMagic to create your Master htaccess files?
    Did you Activate both BulletProof Modes?
    you need to activate Root and wp-admin BulletProof Modes together
    look at the System Info tab in BPS. Is your SAPI type DSO or CGI?

    I am assuming you have DSO and yes you would not be able to use the automation in BPS on a DSO Server because of ownership restrictions / permisssions that DSO imposes. 99% of folks have CGI so the automation works fine for them.

  6. icing
    Posted 3 years ago #

    I used AutoMagic to create Master htaccess file. I activate all 4 bulletproof modes one by one starting from the bottom. SAPI is CGI.

Topic Closed

This topic has been closed to new replies.

About this Topic