Jump to content
APC Forum

Image Issues


Swede

Hot linked images  

34 members have voted

  1. 1. Do you see an image in the first post below?

    • Yes, I see a jar of orange/yellow powder
      31
    • No, I see jack, or a red "X"
      3


Recommended Posts

I could use a bit of help. The pictures I post here, in my blog, and in many other places, sometimes don't show up. They are posted to my domain at 5bears.com, and directly linked. So if the mods don't mind, I'd like to do a test. Here is a small pic:

 

http://www.5bears.com/chem1/chems02.jpg

 

If you CAN'T see it, please be sure that you have "show pictures" enabled in your browser. Sometimes, Browser security settings go a little too far and prevent pictures from off-site from showing up.

 

I always do a preview before posting, to ensure the link is correct and the pics are there. Thanks for your help in troubleshooting.

Edited by Swede
Link to comment
Share on other sites

Is that some kind of lead salt? Looks like something you don't want to eat :P .

 

Your pictures show up perfectly, always.

Link to comment
Share on other sites

Is that some kind of lead salt? Looks like something you don't want to eat :P .

 

Your pictures show up perfectly, always.

 

:lol: It's litharge... PbO. Good eye. I should have found a more entertaining picture.

Link to comment
Share on other sites

Strange, I can't bring up your pics in Chrome, but firefox shows them fine. Even if I go directly to the image URL, nothing comes up in Chrome.. odd

 

I know they worked fine a few days ago, and I haven't changed anything on my PC - browser security is all fairly low.

Edited by tentacles
Link to comment
Share on other sites

It's fine to test this here, Swede.

 

I'm using FF and they display just fine. Same with IE, too.

 

As long as you have your .htaccess file(s) correct, it will work. And it looks like you do. ;)

Link to comment
Share on other sites

Thanks for the help everybody. Tentacles, it's weird, I'm using Chrome as well and have never had image issues, mine or anyone elses. I'm not sure of what's going on.

 

So far it's 15 to 3. There are so many browser combos out there now, it's hard to figure out the failures when they do occur.

Link to comment
Share on other sites

It's possible that the 3 people who can't see the pics, have ISP's that are blocking certain file-types. Not likely, but it *IS* possible. More likely is an incorrect .htaccess file.

 

And, just to cover the basics, you DO have the following 4 lines in your .htaccess file, don't you(?):

 

RewriteCond %{HTTP_REFERER} !^http://apcforum.net/.*$	  [NC]
RewriteCond %{HTTP_REFERER} !^http://apcforum.net$	  [NC]
RewriteCond %{HTTP_REFERER} !^http://www.apcforum.net/.*$	  [NC]
RewriteCond %{HTTP_REFERER} !^http://www.apcforum.net$	  [NC]

 

Those 4 lines allow us (APC Forum) to hotlink to your site.

If they aren't there, you need to add them as above or problems like you're describing will occur.

Link to comment
Share on other sites

Haha, I didn't do anything! But I will take TheSidewinder's excellent suggestions. Lately, I haven't posted any pics to anywhere except APC and maybe SMDB, so I can ensure good linkage by doing what he suggests. His previous tutelage allowed me to put up that corporate splash page in place of my old index.htm. Thanks, TS.

 

I'll do it Tuesday A.M... Then we'll see if there are any issues after that.

Link to comment
Share on other sites

The file has been modified... I cut and pasted what you suggested, TS. My file now looks like this:

 

RewriteEngine on

Options -Indexes

allow from all

 

DirectoryIndex welcome.htm

 

RewriteCond %{HTTP_REFERER} !^http://apcforum.net/.*$ [NC]

RewriteCond %{HTTP_REFERER} !^http://apcforum.net$ [NC]

RewriteCond %{HTTP_REFERER} !^http://www.apcforum.net/.*$ [NC]

RewriteCond %{HTTP_REFERER} !^http://www.apcforum.net$ [NC]

 

There are now 3 "no-see 'ums"... we'll see if this improves things.

 

What does the [NC] at the ends of the lines do?

Edited by Swede
Link to comment
Share on other sites

Heya Swede....

 

[NC] means "No Case" (case-insensitive), so in that line [NC] means that, for example, APCForum, Apcforum, and APCFORUM all pass the test. There are a HUGE number of options for the RewriteCond variable.

 

As long as I'm at it, the following line should be at the top of the .htaccess, above the line, "RewriteEngine on":

 

Options +FollowSymlinks

 

 

At the bottom of the .htaccess file, *IF* you want to show disallowed users a specific page, instead of the default 404(?) error page, add this line:

 

 

RewriteRule .*\.(jpg|jpeg|gif|png|bmp|avi|mov|wma|wmf|wmv|doc|pps|xls)$ /leecher.html [R,NC]

 

Adjust the filetypes (.jpg .jpeg . gif etc) if necessary for your install, and replace "leecher.html" with the name of the page you want to show people if they try to hotlink without permission. The "R" in [R,NC] means do a proper 302 Redirect, although you can specify the type of 300 Redirect error. [R=302,NC] would be redundant, since 302 is the default error, but you COULD specify [R=301,NC] for "Page Moved Permanently". The 300 series of redirects is complex as hell, and I don't understand all of it yet (but I'm getting there!) so this is just the basics.

 

If you want to make SMDB a specifically "allowed" hotlink domain, copy and paste those 4 lines, replacing apcforum.net or www.apcforum.net with (smdb-URL) or www.(smdb-URL).

Link to comment
Share on other sites

Damn, you are a wizard with this stuff! :D Does the act of placing those RewriteCond lines specifically prevent other web sites from hot-linking the pics? In other words, do I need to do a set for each site that I want to allow unlimited hotlinking?

 

To the esteemed assembly - sorry for this being public. I know it's not Pyro related.

 

@TS... Line added. Now I have this:

 

 

Options +FollowSymlinks

RewriteEngine on

Options -Indexes

allow from all

 

DirectoryIndex welcome.htm

 

RewriteCond %{HTTP_REFERER} !^http://apcforum.net/.*$ [NC]

RewriteCond %{HTTP_REFERER} !^http://apcforum.net$ [NC]

RewriteCond %{HTTP_REFERER} !^http://www.apcforum.net/.*$ [NC]

RewriteCond %{HTTP_REFERER} !^http://www.apcforum.net$ [NC]

 

RewriteCond %{HTTP_REFERER} !^www.sciencemadness.org/.*$ [NC]

RewriteCond %{HTTP_REFERER} !^www.sciencemadness.org$ [NC]

RewriteCond %{HTTP_REFERER} !^www.sciencemadness.org/.*$ [NC]

RewriteCond %{HTTP_REFERER} !^www.sciencemadness.org$ [NC]

Edited by Swede
Link to comment
Share on other sites

This is in the Random section and has to do with forums in general, so it's not OT. Besides, I'm an Admin. :rolleyes:

 

First, your bottom 4 lines need a bit of editing:

 

RewriteCond %{HTTP_REFERER} !^www.sciencemadness.org/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^www.sciencemadness.org$ [NC]
RewriteCond %{HTTP_REFERER} !^sciencemadness.org/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^sciencemadness.org$ [NC]

 

You need to specify both the non-www form, as well as the one that also contains www. Hope that made sense.

 

Next, by default as you have it set up, NO site is allowed to hotlink so adding the RewriteCond lines allows specific sites to do so.

 

So yes, if you want a site to be able to hotlink, you'll have to add more entries with the allowed sitename(s) as above.

 

In addition, if you want to block specific IP Ranges, you should add some info above "allow from all" as follows:

 

 

order allow,deny
deny from 140.247 <- blocks 140.27.0.0 through 140.27.255.255
deny from 194.165.42 <- blocks 194.165.42.0 through 194.165.42.255
deny from 83.103.90.5 <- block only the single adddress 83.103.80.5
allow from all

Link to comment
Share on other sites

Thanks TS. Do I need the http:// on the sciencemadness lines, or is it optional? Additionally, is there a way to create a REMARK in this file? I'd like to place some of your suggestions as remarks at the bottom of the file, so in the future, they will be there, ready to use if needed by simply removing the REAMRK token or symbol.

 

I modified the four lines, and added the HTTP to more closely simulate the APC lines.

 

 

RewriteCond %{HTTP_REFERER} !^http://www.sciencemadness.org/.*$ [NC]

RewriteCond %{HTTP_REFERER} !^http://www.sciencemadness.org$ [NC]

RewriteCond %{HTTP_REFERER} !^http://sciencemadness.org/.*$ [NC]

RewriteCond %{HTTP_REFERER} !^http://sciencemadness.org$ [NC]

Link to comment
Share on other sites

WHOOPS!!!

 

I overlooked your syntax, then compounded the error with my answer.

 

Yes, you need the http:// prefix there, as you've edited it.

 

As to Comments within the .htaccess file, here's the official word from Apache:

 

"Comments are essential to maintaining control over any involved portion of code. Comments in .htaccess code are fashioned on a per-line basis, with each line of comments beginning with a pound sign #. Thus, comments spanning multiple lines in the .htaccess file require multiple pound signs. Further, due to the extremely volatile nature of htaccess voodoo, it is wise to include only alphanumeric characters (and perhaps a few dashes and underscores) in any .htaccess comments."

 

so a line that says:

 

# This is a comment

 

should be fine, but you should avoid commenting actual directives such as:

 

# RewriteCond %{HTTP_REFERER} !^http://www.whatever-domain.org/.*$ [NC]

 

because it MIGHT be interpreted rather than ignored. At least, that's how *I* interpret what that says.

Link to comment
Share on other sites

As to Comments within the .htaccess file, here's the official word from Apache:

 

"Further, due to the extremely volatile nature of htaccess voodoo, it is wise to include only alphanumeric characters (and perhaps a few dashes and underscores) in any .htaccess comments."

 

Did you really get that from Apache docs? My v2.2 docs simply say

 

'Lines that begin with the hash character "#" are considered comments, and are ignored. Comments may not be included on a line after a configuration directive.'

 

The only situation where I can imagine symbols causing problems would be where someone escapes the EOL character and their comment flows onto the next line, which wouldn't really be unexpected behaviour.

 

I've certainly got plenty of lines commented out in my main httpd.conf, various include files and .htaccess files and I've never had a problem.

Link to comment
Share on other sites

No, I pulled those words straight out of my ass. :D

 

 

 

Actually that quote came directly from several pages I found, though not from Apache's official site (which I searched seperately today). Search Google for the full unquoted phrase and you'll get a boatload of them. Many are several years old, true, but something like this should *generally* carry through on upgrades

 

It's possible that the caution is no longer valid, I just don't know for sure. But it's always good form to use simple commenting wherever possible anyway.

Link to comment
Share on other sites

  • 3 months later...
×
×
  • Create New...