No Images

B

Blinky the Shark

Jonathan said:
Blinky said:
Blinky said:
Beauregard T. Shagnasty wrote:
Blinky the Shark wrote:

What the heck? I'm not getting any images rendered.

I'm getting ready to move blinkynet to a new host. I'm testing
the new location. I figured if anything, scripting would be the
issue, but PHP's working fine with just a config.php tweak for the
new location.

Here's the address (I'm not live yet, thank God). :)

http://server19.01domain.net/~blinky/indexdowntowntest.html

No images. As I look at page source, img src is correct.
It appears to me that .jpg files are being served as "text/html"
Obviously a configuration issue on the server.
Then how are they displayable if you rightclick and select "View
Image"? Same server, right?

The .gif at the top is of type: "image/gif"
That one won't display either.

How are they then displayable if you rightclick and select "View
Image"?

Found something nobody's mentioned. :)

I still have the experimental 2x3 grid of image path attempts here:

http://72.52.154.100/~blinky/imagetest.html

Okay, the first two apparently break for having the home directory in
the path. Let's pretend they're not there...

...because I have all of the other four tries on that page working.

wOOt!

What I did was comment out a line in .htaccess:

#RewriteRule .*\.(jpg|jpeg|gif|png|bmp)$ - [F,NC]

I don't know what it does <g>, but one of its effects seems to have
been the prevention of image display.

I certainly hope you are joking, that would certainly cause your
problem!

I don't know what that line did, but I know commenting it out seems to
have solved the issue of not seing graphics even withthe right path
coded. When I commented it out, I got images on that imagetest.html
page. As outlined above. So no, I'm not joking. And whatever it does
didn't bother my site (still live) at Page-Zone. It's the same
..htaccess I was using there. (I'm about to switch my DNS pointers to
the new site.)
 
T

Toby A Inkster

Blinky said:
What I did was comment out a line in .htaccess:

#RewriteRule .*\.(jpg|jpeg|gif|png|bmp)$ - [F,NC]

What this line means is:

For any file that ends with any of these:

.jpg
.jpeg
.gif
.png
.bmp

then forbid access.

--
Toby A Inkster BSc (Hons) ARCS
Contact Me ~ http://tobyinkster.co.uk/contact
Geek of ~ HTML/CSS/Javascript/SQL/Perl/PHP/Python*/Apache/Linux

* = I'm getting there!
 
B

Blinky the Shark

Toby said:
Blinky said:
What I did was comment out a line in .htaccess:

#RewriteRule .*\.(jpg|jpeg|gif|png|bmp)$ - [F,NC]

What this line means is:

For any file that ends with any of these:

.jpg
.jpeg
.gif
.png
.bmp

then forbid access.

Holy cats. I can't imagine where that came from. It's not, like,
something I'd want to do. :)

Is there any chance that's something that, say, cPanel might do if one
were to enable hot-link blocking? Like perhaps it would only apply to
image requests that didn't come from within the site?

I seem to have an .htaccess in my images directory, as well.
 
B

Blinky the Shark

Blinky said:
What the heck? I'm not getting any images rendered.

I'm getting ready to move blinkynet to a new host. I'm testing the new
location. I figured if anything, scripting would be the issue, but
PHP's working fine with just a config.php tweak for the new location.

Here's the address (I'm not live yet, thank God). :)

http://server19.01domain.net/~blinky/indexdowntowntest.html

No images. As I look at page source, img src is correct.

And here's Stumper 2 -- if I rightclick an alt display, say, the "Shark
Photo" image in the third paragraph, and select View Image, it displays fine
that way. But not in the page. That image is hard coded, not placed
into that position via a script; so, again, it's not a scripting issue.

What am I missing here?

Compare: Still live at Page-Zone http://blinkynet.net

All fixed. Site relocated. Thanks for all who worked with me on it.

It turns out that the only things I had to do to get the whole site
working was to:

1. Comment out that .htaccess line that was blocking display of images;
I have no idea where that line came from.

2. Change the user directory name in this line which appears on every
page on the site

<?php include ("/home/blinky/public_html/includes/config.php"); ?>

to "blinky".

I was "blinky" at Page-Zone, so that I wouldn't have had to do that,
except that when they upgraded their servers recently they changed my
user directory to another name (without any notification). I had to
change those lines from ...blinky... to the new directory name; and now
I had to change them back for the move. :)

THAT part I knew about from the beginning.

As for my posting for help here in the first case, that was when I was
trying to get the newly located site together so that when I changed the
DNS pointers it'd already be shipshape. But that - accessing the new
location as http://[server IP]/~username - was what was making shit not
work normally over and above the two fixes above. Tonight I bit the bullet
and went live to see if I was right that that would make thing work,
even though that meant a dirty changeover, and that proved to be the case.

Thanks, again, gang [ting] for the thoughts.
 
J

Jonathan N. Little

Blinky said:
Toby said:
Blinky said:
What I did was comment out a line in .htaccess:

#RewriteRule .*\.(jpg|jpeg|gif|png|bmp)$ - [F,NC]
What this line means is:

For any file that ends with any of these:

.jpg
.jpeg
.gif
.png
.bmp

then forbid access.

Holy cats. I can't imagine where that came from. It's not, like,
something I'd want to do. :)

Is there any chance that's something that, say, cPanel might do if one
were to enable hot-link blocking? Like perhaps it would only apply to
image requests that didn't come from within the site?

I seem to have an .htaccess in my images directory, as well.
There probably was a preceding line with a RewriteCond statement that
test if the host is your domain name.

# IF referring is not "mydomain.com"
RewriteCond %{HTTP_REFERER} !^http://(www\.)?mydomain.com/.*$ [NC]

Since you have an new domain your are testing you need to allow it... or
remove the rule entirely...
 
T

Toby A Inkster

Blinky said:
Is there any chance that's something that, say, cPanel might do if one
were to enable hot-link blocking? Like perhaps it would only apply to
image requests that didn't come from within the site?

Quite possibly -- there would normally be a preceding line that specified
a particular condition for when that rule should fire.

--
Toby A Inkster BSc (Hons) ARCS
Contact Me ~ http://tobyinkster.co.uk/contact
Geek of ~ HTML/CSS/Javascript/SQL/Perl/PHP/Python*/Apache/Linux

* = I'm getting there!
 
B

Blinky the Shark

Jonathan said:
Blinky said:
Toby said:
Blinky the Shark wrote:

What I did was comment out a line in .htaccess:

#RewriteRule .*\.(jpg|jpeg|gif|png|bmp)$ - [F,NC]
What this line means is:

For any file that ends with any of these:

.jpg
.jpeg
.gif
.png
.bmp

then forbid access.

Holy cats. I can't imagine where that came from. It's not, like,
something I'd want to do. :)

Is there any chance that's something that, say, cPanel might do if one
were to enable hot-link blocking? Like perhaps it would only apply to
image requests that didn't come from within the site?

I seem to have an .htaccess in my images directory, as well.
There probably was a preceding line with a RewriteCond statement that
test if the host is your domain name.

# IF referring is not "mydomain.com"
RewriteCond %{HTTP_REFERER} !^http://(www\.)?mydomain.com/.*$ [NC]

Since you have an new domain your are testing you need to allow it... or
remove the rule entirely...

Here's that part of my .htaccecss (the one in my document root:

RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://blinkynet.net/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://blinkynet.net$ [NC]
RewriteCond %{HTTP_REFERER} !^http://www.blinkynet.net/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://www.blinkynet.net$ [NC]
#RewriteRule .*\.(jpg|jpeg|gif|png|bmp)$ - [F,NC]

Looks sensible?

There's none of that in the .htaccess that's in my images subdirectory,
and since there are lines like AddHandler and DefaultCharset in that one
I sense it's a file that simply got mis-saved to the wrong place.
Agree?
 
B

Blinky the Shark

Toby said:
Quite possibly -- there would normally be a preceding line that specified
a particular condition for when that rule should fire.

There doesn't seem to be. I just posted that whole block in my response
to Jonathan, if you'd like to take a peek.
 
R

Rik

Blinky the Shark said:
Is there any chance that's something that, say, cPanel might do if one
were to enable hot-link blocking? Like perhaps it would only apply to
image requests that didn't come from within the site?

I seem to have an .htaccess in my images directory, as well.
There probably was a preceding line with a RewriteCond statement that
test if the host is your domain name.

# IF referring is not "mydomain.com"
RewriteCond %{HTTP_REFERER} !^http://(www\.)?mydomain.com/.*$ [NC]

Since you have an new domain your are testing you need to allow it... or
remove the rule entirely...

Here's that part of my .htaccecss (the one in my document root:

RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://blinkynet.net/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://blinkynet.net$ [NC]
RewriteCond %{HTTP_REFERER} !^http://www.blinkynet.net/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://www.blinkynet.net$ [NC]
#RewriteRule .*\.(jpg|jpeg|gif|png|bmp)$ - [F,NC]
Looks sensible?


Well, the .htaccess in the root will also process all requests for the
images directory.

This is indeed clearly a rule to prevent hot-linking, allthough it could
be very shorter:

RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www\.)?blinkynet.net(/|$) [NC]
RewriteRule \.(jpg|jpeg|gif|png|bmp)$ - [F]
There's none of that in the .htaccess that's in my images subdirectory,
and since there are lines like AddHandler and DefaultCharset in that one
I sense it's a file that simply got mis-saved to the wrong place.

There's no way for us to tell how it got there, and what it's purpose was
:p
 
B

Blinky the Shark

Rik said:
Blinky the Shark said:
Is there any chance that's something that, say, cPanel might do if one
were to enable hot-link blocking? Like perhaps it would only apply to
image requests that didn't come from within the site?

I seem to have an .htaccess in my images directory, as well.

There probably was a preceding line with a RewriteCond statement that
test if the host is your domain name.

# IF referring is not "mydomain.com"
RewriteCond %{HTTP_REFERER} !^http://(www\.)?mydomain.com/.*$ [NC]

Since you have an new domain your are testing you need to allow it... or
remove the rule entirely...

Here's that part of my .htaccecss (the one in my document root:

RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://blinkynet.net/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://blinkynet.net$ [NC]
RewriteCond %{HTTP_REFERER} !^http://www.blinkynet.net/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://www.blinkynet.net$ [NC]
#RewriteRule .*\.(jpg|jpeg|gif|png|bmp)$ - [F,NC]
Looks sensible?

And I was getting images blocked because I was accessing that
not-live-yet site by IP/~username, right?
Well, the .htaccess in the root will also process all requests for the
images directory.

Unless overridden by another .htaccess *in* the images directory, right?
(And that one would cover all subdirs under it, right?)
This is indeed clearly a rule to prevent hot-linking, allthough it could
be very shorter:

RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www\.)?blinkynet.net(/|$) [NC]
RewriteRule \.(jpg|jpeg|gif|png|bmp)$ - [F]

That to be used instead of the lines I pasted?
There's no way for us to tell how it got there, and what it's purpose was
:p

Well, no shit. :) My question meant, "Are there any reasons that a
separate .htaccess in an images directory might be useful?"
 
R

Rik

Blinky the Shark said:
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://blinkynet.net/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://blinkynet.net$ [NC]
RewriteCond %{HTTP_REFERER} !^http://www.blinkynet.net/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://www.blinkynet.net$ [NC]
#RewriteRule .*\.(jpg|jpeg|gif|png|bmp)$ - [F,NC]
Looks sensible?

RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www\.)?blinkynet.net(/|$) [NC]
RewriteRule \.(jpg|jpeg|gif|png|bmp)$ - [F]

That to be used instead of the lines I pasted?

Yup, does exactly the same, only shorter. One could even take the empty
referer in the same statement:

RewriteCond %{HTTP_REFERER} !^(http://(www\.)?blinkynet.net(/|$)|$) [NC]
RewriteRule \.(jpe?g|gif|png|bmp)$ - [F]

Tends to get a bit unreadable though :)
Well, no shit. :) My question meant, "Are there any reasons that a
separate .htaccess in an images directory might be useful?"

..htaccess files slow apache down. It makes sense to place an .htaccess
only in the directory where it's applicable, and not in the root, so other
requests won't have to deal with it.

On the other hand checking a lot of different .htaccess files might slow
it down too. I'm not sure when this becomes a factor.
 
B

Blinky the Shark

Rik said:
Blinky the Shark said:
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://blinkynet.net/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://blinkynet.net$ [NC]
RewriteCond %{HTTP_REFERER} !^http://www.blinkynet.net/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://www.blinkynet.net$ [NC]
#RewriteRule .*\.(jpg|jpeg|gif|png|bmp)$ - [F,NC]
Looks sensible?

RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www\.)?blinkynet.net(/|$) [NC]
RewriteRule \.(jpg|jpeg|gif|png|bmp)$ - [F]

That to be used instead of the lines I pasted?

Yup, does exactly the same, only shorter. One could even take the empty
referer in the same statement:

Well, I can't find anything wring with brevity, if it gets the job done.
I'll plug that in and nuke the old stuff. Thanks.
RewriteCond %{HTTP_REFERER} !^(http://(www\.)?blinkynet.net(/|$)|$) [NC]
RewriteRule \.(jpe?g|gif|png|bmp)$ - [F]

Tends to get a bit unreadable though :)
:)
Well, no shit. :) My question meant, "Are there any reasons that a
separate .htaccess in an images directory might be useful?"

.htaccess files slow apache down. It makes sense to place an .htaccess
only in the directory where it's applicable, and not in the root, so other
requests won't have to deal with it.

On the other hand checking a lot of different .htaccess files might slow
it down too. I'm not sure when this becomes a factor.

Understand. Thanks.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,020
Latest member
GenesisGai

Latest Threads

Top