WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Help modifying .htaccess (5 posts)

  1. oldmankit
    Member
    Posted 3 years ago #

    I'm trying to stop hotlinking. How do I change the following so that it allows hotlinking from any of the subdomains at peaceandtruth.com? (e.g. blog.peaceandtruth.com)

    '# block hotlinking
    RewriteEngine on
    RewriteCond %{HTTP_REFERER} !^$
    RewriteCond %{HTTP_REFERER} !^http://(www\.)?peaceandtruth.com/.*$ [NC]
    RewriteRule \.(gif|jpg|js|css)$ - [F]'

    Thanks!

  2. Open your .htaccess file.

    Add that code ABOVE the calls to WordPress.

    Save.

    You'll need some sort of FTP or file editing client on your PC to go edit the file, mind you. And you'll need to make sure you 'show hidden files'. Your host should have some directions on how they want you do that.

  3. oldmankit
    Member
    Posted 3 years ago #

    Thanks. What I am really looking for is to allow subdomains.

    The above code words fine (I've tried it), however, the only subdomain it allows is http://www.peaceandtruth.com. I want to allow all subdomains for peaceandtruth.com. e.g. blog.peaceandtruth.com.

  4. Thanks. What I am really looking for is to allow subdomains.

    Oh :) You'll like this, then.

    http://perishablepress.com/press/2007/11/21/creating-the-ultimate-htaccess-anti-hotlinking-strategy/

  5. oldmankit
    Member
    Posted 3 years ago #

    Thanks for the link, it was very thorough. What I was looking for-a catch-all for any requests from my site- was something like this:

    https?://([^.]+\.)?peaceandtruth\.([^.]+\.)?

Topic Closed

This topic has been closed to new replies.

About this Topic