Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
Showing results for
.htaccess Question
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Plusnet Community
- :
- Forum
- :
- Help with my Plusnet services
- :
- Everything else
- :
- .htaccess Question
.htaccess Question
14-08-2012 8:48 PM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
I have the following in the .htaccess on my webspace, intended to prevent hotlinking:
People are telling me that this is stopping them even from viewing images on my webspace if I provide them with a direct link to the image, e.g. http://www.thejudge.me.uk/imagebank/photos/kw_catalogue_me.jpg.
What do I need to amend in the .htaccess to stop that from happening? Or am I missing something simple here?
Quote RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www\.)?<domain name>.*$ [NC]
RewriteRule \.(gif|jpg|png|wmv)$ -
People are telling me that this is stopping them even from viewing images on my webspace if I provide them with a direct link to the image, e.g. http://www.thejudge.me.uk/imagebank/photos/kw_catalogue_me.jpg.
What do I need to amend in the .htaccess to stop that from happening? Or am I missing something simple here?
Message 1 of 6
(3,166 Views)
5 REPLIES 5
Re: .htaccess Question
15-08-2012 12:17 AM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
How do you provide the direct link to those you invite to view the image? If it's in a forum post such as here, then the forum site will be sent as the referrer, and the rule blocks access. In this case the forum site would have to be excluded by a negative condition like that for <domain name>, or some other property needs to be checked,.
If invitees copied the link into their browser's address bar (or clicked a link in an email) the referrer would be empty, and the first exception allows that.
If invitees copied the link into their browser's address bar (or clicked a link in an email) the referrer would be empty, and the first exception allows that.
David
Message 2 of 6
(426 Views)
Re: .htaccess Question
15-08-2012 9:34 PM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
In the cases in question, the link has been a hyperlink in a forum post. As it's a forum where I'm a mod, I might as well exclude that as well.
What would the syntax be for that? Would it be:
RewriteCond %{HTTP_REFERER} !^http://(www\.)?<forum domain name>.*$ [NC]
What would the syntax be for that? Would it be:
RewriteCond %{HTTP_REFERER} !^http://(www\.)?<forum domain name>.*$ [NC]
Message 3 of 6
(426 Views)
Re: .htaccess Question
16-08-2012 12:09 AM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
That's the idea, but it depends whether the subdomain is www, and whether that is optional. For example, for a link posted in the Community forum the exclusion condition would be
That would allow links from forum posts but exclude them from elsewhere on the site - up to you whether you want to be that specific.
RewriteCond %{HTTP_REFERER} !^http://community\.plus\.net/forum/.*$ [NC]
That would allow links from forum posts but exclude them from elsewhere on the site - up to you whether you want to be that specific.
David
Message 4 of 6
(426 Views)
Re: .htaccess Question
17-08-2012 8:38 PM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
Tried that, but it's still blocking the link from the forum I posted it in.
Is there actually a combination of code which will prevent hotlinking but allow viewing?
Is there actually a combination of code which will prevent hotlinking but allow viewing?
Message 5 of 6
(426 Views)
Re: .htaccess Question
18-08-2012 2:01 AM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
As far as I'm aware the server can't tell the difference between a reference to display within a page (hotlink) and a clicked link to display in the browser (view).
However I've just tried this from Community to a jpg image on my site and the exception posted above worked OK. I got 403 forbidden without the Community condition in .htaccess, but the image displayed OK when I added it.
HTTP_REFERER contained
Are you sure you didn't make a typo?
However I've just tried this from Community to a jpg image on my site and the exception posted above worked OK. I got 403 forbidden without the Community condition in .htaccess, but the image displayed OK when I added it.
HTTP_REFERER contained
http://community.plus.net/forum/index.php?action=post;topic=106986.0;num_replies=4
Are you sure you didn't make a typo?
David
Message 6 of 6
(426 Views)
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page