Zen Cart Logo
Forums / General Questions / .htaccess Blocking Images

.htaccess Blocking Images

Locked

Views: 2,365

Results 1 to 7 of 7
This thread is locked. New replies are disabled.
24 Jul 2007, 2:48 AM
#1
chava avatar

chava

New Zenner

Join Date:
Apr 2007
Posts:
40
Plugin Contributions:
0

.htaccess Blocking Images

Some code was added to my .htaccess file under public_html, and I have no clue how it got there. Possibly when I was changing permission numbers for some folders. Just realized there was a problem for others accessing images on my site when I was using practiceboard and all my images had red x's. Everything was fine on my computer, so I didn't realize there was a problem.
My site host had me change the .htaccess folder name because she saw some suspect code. Once I did this, the images were fine. To my knowledge, all I have done intentionally to alter this file, is add some IP address to my deny list in Cpanel.
Here is the code:
# -FrontPage-

IndexIgnore .htaccess /.?? ~ # /HEADER /README /_vti

<Limit GET POST>
#The next line modified by DenyIP
order allow,deny
#The next line modified by DenyIP
#deny from all
allow from all
</Limit>
<Limit PUT DELETE>
order deny,allow
deny from all
</Limit>
AuthName https://www.xxxxxxxxxxx.com
AuthUserFile /xxxxxxxxx
AuthGroupFile /xxxxxxxxxxx

<Files 403.shtml>
order allow,deny
allow from all
</Files>

deny from xx.xxx.xxx.xx
deny from xx.xxx.xx.xxx


RewriteEngine on
RewriteCond %{HTTP_REFERER} !^http://xxxxxxxxxx.com/.
$ [NC]
RewriteCond %{HTTP_REFERER} !^http://xxxxxxxxxx.com$ [NC]
RewriteCond %{HTTP_REFERER} !^http://www.xxxxxxxxxx.com/.
$ [NC]
RewriteCond %{HTTP_REFERER} !^http://www.xxxxxxxxxx.com$ [NC]
RewriteRule .*.(jpg|jpeg|gif|png|bmp)$ - [F,NC]
deny from xxx.xxx.xx.xxx
deny from xxx.xxx.xxx.xx

My question is, how do I change this file so it has the correct code. Right now, renamed, it is inaccessible.
I noticed when I went back into my site files, another .htaccess file had been added, which I thought was empty yesterday.:shocking: but now today has this code:
# $Id: .htaccess 1105 2005-04-04 22:05:35Z birdbrain $
#
# This is used with Apache WebServers
#
# For this to work, you must include the parameter 'Options' to
# the AllowOverride configuration
#
# Example:
#
# <Directory "/usr/local/apache/htdocs">
# AllowOverride Options
# </Directory>
#
# 'All' with also work. (This configuration is in the
# apache/conf/httpd.conf file)

# The following makes adjustments to the SSL protocol for Internet
# Explorer browsers

<IfModule mod_setenvif.c>
<IfDefine SSL>
SetEnvIf User-Agent ".MSIE."
nokeepalive ssl-unclean-shutdown
downgrade-1.0 force-response-1.0
</IfDefine>
</IfModule>

# Fix certain PHP values

#<IfModule mod_php4.c>
# php_value session.use_trans_sid 0
# php_value register_globals 1
#</IfModule>

# to turn off register_globals
# php_value register_globals 0

I had looked into the administration/.htaccess file to see the code. Then went to public_html/.htaccess to view it, and was asked if I wanted to overwrite it, I clicked skip, and when I viewed the file, it now has the same code as the admin. file.

My question: what do I do? Is the new .htaccess file code correct, or is the one first above correct, but needs some code changes. Hope this makes sense because it's all very confusing.
Thanks anyone.

24 Jul 2007, 6:08 PM
#2
chava avatar

chava

New Zenner

Join Date:
Apr 2007
Posts:
40
Plugin Contributions:
0

Re: .htaccess Blocking Images

Bumping up, hoping someone can help me with this.
Thanks.

24 Jul 2007, 8:03 PM
#3
brandtim avatar

brandtim

Zen Follower

Join Date:
Apr 2006
Posts:
250
Plugin Contributions:
0

Re: .htaccess Blocking Images

What you are asking for help with is very complex... I doubt you will get any helpful responses until you provide a url to see the site live and the non-edited version of your .htaccess file... otherwise it's just too difficult to diagnose.

BrandTim

24 Jul 2007, 11:38 PM
#4
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
177

Re: .htaccess Blocking Images

chava:

Just realized there was a problem for others accessing images on my site when I was using practiceboard and all my images had red x's.

...

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

Put a # in front of it, and your images will likely display properly again.

Your cPanel will update your public_html/.htaccess file with several things depending on what you click. For example, that's how the "deny from" entries most likely got in there, etc.
I imagine there is cpanel documentation available from your hosting company or at cpanel's main website.
25 Jul 2007, 3:41 AM
#5
chava avatar

chava

New Zenner

Join Date:
Apr 2007
Posts:
40
Plugin Contributions:
0

Re: .htaccess Blocking Images

The only edits I made to the file were xing out my site name and the IP addressed I banned. So, I don't think they have any bearing on the problem.

Thanks DrByte. I added the # in front of the image code, renamed the .htaccess file back, and the images disappeared again when posting to the photobucket practiceboard. When I change the .htaccess file name again, the images are back. Does that indicate that there is some other code in that file that is affecting my images.?

25 Jul 2007, 3:42 AM
#6
chava avatar

chava

New Zenner

Join Date:
Apr 2007
Posts:
40
Plugin Contributions:
0

Re: .htaccess Blocking Images

Should also mention that Hotlink Protection is disabled, so I don't think that is causing the problem.

25 Jul 2007, 1:49 PM
#7
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
177

Re: .htaccess Blocking Images

  1. Your server's errorlog should be telling you about any errors it sees in the .htaccess

  2. Selectively removing or commenting EACH line in the file should help you narrow down the cause.
    Maybe start with a blank file, and then add each line/section back one at a time to see when things break.
    Note that some "sections" must all go together, such as the IF statements and the directives that start with a <section> and end with a </section> tag etc. The individual lines inside them can be commented with a #