Web Hosting Forum | Lunarpages
News: October 6, 2008 - Submit Your Site for the October 2008 Site of the Month!
 
*
Welcome, Guest. Please login or register.
Did you miss your activation email?
October 14, 2008, 02:27:05 AM


Login with username, password and session length


Pages: [1] 2   Go Down
  Print  
Author Topic: is my .htaccess right? Images not showing...  (Read 293 times)
Brennie369
Spaceship Captain
*****
Offline Offline

Posts: 115



WWW
« on: July 23, 2008, 12:17:20 PM »

Hi, awhile ago I enabled my hot link protection in cPanel for about 6 or 7 sites. Recently I went back in to remove one because that site is no longer active.

So now on one of my sites - the eCommerce one, when I visit the admin side all images are broken. I checked my main .htaccess file but I have no clue if it got messed up or not. Can someone take a look & help me?

This is it - the url that should not be in there is dingleberrycandleco - it was replaced with dreamsoy. Plus I have no idea why there's 2 of each - is it supposed to be that way?:
Code:
RewriteEngine on
ErrorDocument 404 /404.shtml
Options -Indexes

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

RewriteCond %{HTTP_HOST} ^.*$
RewriteRule ^dingleberrycandleco/?$ http://www.dreamsoy.com [R=301,L]

RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www\.)?.*brenniesdreamscape.com(/)?.*/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^http://(www\.)?.*brenniesdreamscape.com(/)?.*$      [NC]
RewriteCond %{HTTP_REFERER} !^http://(www\.)?createwithintent.com(/)?.*/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^http://(www\.)?createwithintent.com(/)?.*$      [NC]
RewriteCond %{HTTP_REFERER} !^http://(www\.)?dreamscapedirectory.com(/)?.*/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^http://(www\.)?dreamscapedirectory.com(/)?.*$      [NC]
RewriteCond %{HTTP_REFERER} !^http://(www\.)?dreamscapewebdesigns.com(/)?.*/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^http://(www\.)?dreamscapewebdesigns.com(/)?.*$      [NC]
RewriteCond %{HTTP_REFERER} !^http://(www\.)?dreamsoy.com(/)?.*/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^http://(www\.)?dreamsoy.com(/)?.*$      [NC]
RewriteCond %{HTTP_REFERER} !^http://(www\.)?gregandbren.com(/)?.*/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^http://(www\.)?gregandbren.com(/)?.*$      [NC]
RewriteCond %{HTTP_REFERER} !^http://(www\.)?lunarforums.com(/)?.*/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^http://(www\.)?lunarforums.com(/)?.*$      [NC]
RewriteRule .*\.(jpg|jpeg|gif|png|bmp|pdf)$ - [F,NC]
Logged
MrPhil
Quantum Encyclopedia Writer
*****
Offline Offline

Posts: 3400



« Reply #1 on: July 26, 2008, 08:21:58 PM »

Which one is the eCommerce site? Is it only on the admin sde that images are broken, but are OK on the public side?

A couple of things to clean up...

Code:
RewriteCond %{HTTP_HOST} ^.*$
RewriteRule ^dingleberrycandleco/?$ http://www.dreamsoy.com [R=301,L]

you can change to just

Code:
RewriteRule ^dingleberrycandleco/?(.*)$  http://www.dreamsoy.com  [R=301]

Change each pair like

Code:
RewriteCond %{HTTP_REFERER} !^http://(www\.)?dreamscapedirectory.com(/)?.*/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^http://(www\.)?dreamscapedirectory.com(/)?.*$      [NC]

to just

Code:
RewriteCond %{HTTP_REFERER}  !^http://(www\.)?dreamscapedirectory\.com(/)?.*$  [NC]

Then come back if you're still having problems.
Logged

Brennie369
Spaceship Captain
*****
Offline Offline

Posts: 115



WWW
« Reply #2 on: July 27, 2008, 08:14:40 AM »

Hi MrPhil,

I made the changes you suggested (new .htaccess code below) & now the images are broken on all of the pages except brenniesdreamscape.com (which is my main domain).

To answer your question - at first the broken images were only on the admin side of the eCommerce store (which is dreamsoy.com) - the store side, & all other sites were fine.

BUT, I had noticed that since making the changes to the hotlink, my SEO feature on my shopping cart was no longer working. It wouldn't recognize the search engine friendly URL's & no pages could be accessed from the home page, so I disabled the SEO feature & the pages were then accessible again.

I have a ticket into my shopping cart support but if you can help me with that too, that'd be great!

NEW CODE changed per your suggestions:
Code:
RewriteEngine on
ErrorDocument 404 /404.shtml
Options -Indexes

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

RewriteCond %{HTTP_REFERER}  !^http://(www\.)?brenniesdreamscape\.com(/)?.*$  [NC]
RewriteCond %{HTTP_REFERER}  !^http://(www\.)?createwithintent\.com(/)?.*$  [NC]
RewriteCond %{HTTP_REFERER}  !^http://(www\.)?dreamscapedirectory\.com(/)?.*$  [NC]
RewriteCond %{HTTP_REFERER}  !^http://(www\.)?dreamscapewebdesigns\.com(/)?.*$  [NC]
RewriteCond %{HTTP_REFERER}  !^http://(www\.)?dreamsoy\.com(/)?.*$  [NC]
RewriteCond %{HTTP_REFERER}  !^http://(www\.)?gregandbren\.com(/)?.*$  [NC]
RewriteCond %{HTTP_REFERER}  !^http://(www\.)?lunarforums\.com(/)?.*$  [NC]
RewriteRule .*\.(jpg|jpeg|gif|png|bmp)$ - [F,NC]

Also I tried adding CSS to the file types to protect & after doing that, my own sites couldn't access the css & were appearing "unstyled".

Also on the code I removed the redirect because that site is no longer active & no redirects are required now.

EDIT: I forgot to mention that I have SSL installed on my cart & I do have it enabled in the admin section too, so could that be why the images wouldn't show there? Since the admin domains have https?

~Brenda
« Last Edit: July 27, 2008, 08:19:58 AM by Brennie369 » Logged
MrPhil
Quantum Encyclopedia Writer
*****
Offline Offline

Posts: 3400



« Reply #3 on: July 27, 2008, 07:59:42 PM »

That's odd that all your images no longer work. It seems to work for me on my site. Try going back to pairs of rules:

Code:
RewriteCond %{HTTP_REFERER}  !^http://(www\.)?dreamscapedirectory\.com/.*$  [NC]
RewriteCond %{HTTP_REFERER}  !^http://(www\.)?dreamscapedirectory\.com$  [NC]

and see if that improves matters. Even if your add-ons were coming in as brenniesdreamscape.com/add-on_name, I'd think that it would still work. It must just be something different on your server's configuration that doesn't do well with the code I suggested. Sorry about that!

If your own sites were being blocked from accessing your .css files when you added that extension to the list, that would suggest that your exceptions list (whitelist) was not being recognized at all. Get it working properly for image files before extending the list.

Yes, if you're using https: (SSL) on any domain, you will definitely need to put that in the whitelist. I think you can just do ... !^https?://..., but if not, add another RewriteCond entry for https://.
Logged

Brennie369
Spaceship Captain
*****
Offline Offline

Posts: 115



WWW
« Reply #4 on: July 28, 2008, 08:29:50 AM »

That isn't working for me either - images broken on all sites.

So I went in & disabled again & re-enabled letting cPanel edit the .htaccess file & then I added the https & that isn't working either.
Logged
MrPhil
Quantum Encyclopedia Writer
*****
Offline Offline

Posts: 3400



« Reply #5 on: July 28, 2008, 07:20:47 PM »

Well then, could you post your .htaccess file that "mostly" works, and describe what doesn't  quite work, and do the same with your changed version that doesn't work, and how that fails. Maybe we can see what's going on right now. By the way, you have  cleared your browser cache after making any changes?
Logged

Dinu
Support
Intergalactic Superstar
*****
Offline Offline

Posts: 171


Learning Wordpress :)


« Reply #6 on: July 29, 2008, 09:36:37 AM »

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

That line gives you trouble .. remove it Very Happy
Logged

Greetings !!!
Dinu
Brennie369
Spaceship Captain
*****
Offline Offline

Posts: 115



WWW
« Reply #7 on: July 29, 2008, 09:44:52 AM »

Hi MrPhil & Dinu:

I do clear cache, most certainly.  Smiling At this point the hotlink protection is disabled because I can't have all my sites with broken images. I have a support ticket going but I must say, I'm quite disappointed with that & am still at square one. So with it disabled, there's currently nothing in the .htaccess as far as image protection. And nothing seems to work - ONLY my main domain on my account seems to have images at all times working.

Dino, will removing that line mean those file types aren't protected?

Thanks
Logged
MrPhil
Quantum Encyclopedia Writer
*****
Offline Offline

Posts: 3400



« Reply #8 on: July 29, 2008, 08:16:59 PM »

That line gives you trouble .. remove it

What in the wide, wide, world of sports are you talking about? That line is the whole point of hotlink protection. If the domain making the request (HTTP_REFERER) is not in the whitelist, that line says to take any request ending with an image filetype and make it fail. The problem is up above in the whitelist of allowed sites... not in the RewriteRule.
Logged

Brennie369
Spaceship Captain
*****
Offline Offline

Posts: 115



WWW
« Reply #9 on: July 30, 2008, 09:42:55 AM »

Here's a copy of my .htaccess file where it doesn't work, except for my main domain (brenniesdreamscape.com). This is also how lunarpages support said they fixed it but all images are broken still (except brenniesdreamscape). I have lunarforums for my avatar  Very Happy:

Code:
RewriteEngine on
ErrorDocument 404 /404.shtml
Options -Indexes

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

RewriteCond %{HTTP_REFERER} !^http://brenniesdreamscape.com/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^http://brenniesdreamscape.com$      [NC]
RewriteCond %{HTTP_REFERER} !^http://createwithintent.brenniesdreamscape.com/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^http://createwithintent.brenniesdreamscape.com$      [NC]
RewriteCond %{HTTP_REFERER} !^http://dreamscapedirectory.brenniesdreamscape.com/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^http://dreamscapedirectory.brenniesdreamscape.com$      [NC]
RewriteCond %{HTTP_REFERER} !^http://dreamscapewebdesigns.brenniesdreamscape.com/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^http://dreamscapewebdesigns.brenniesdreamscape.com$      [NC]
RewriteCond %{HTTP_REFERER} !^http://dreamsoy.brenniesdreamscape.com/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^http://dreamsoy.brenniesdreamscape.com$      [NC]
RewriteCond %{HTTP_REFERER} !^http://gregandbren.brenniesdreamscape.com/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^http://gregandbren.brenniesdreamscape.com$      [NC]
RewriteCond %{HTTP_REFERER} !^http://www.brenniesdreamscape.com/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^http://www.brenniesdreamscape.com$      [NC]
RewriteCond %{HTTP_REFERER} !^http://www.createwithintent.brenniesdreamscape.com/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^http://www.createwithintent.brenniesdreamscape.com$      [NC]
RewriteCond %{HTTP_REFERER} !^http://www.dreamscapedirectory.brenniesdreamscape.com/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^http://www.dreamscapedirectory.brenniesdreamscape.com$      [NC]
RewriteCond %{HTTP_REFERER} !^http://www.dreamscapewebdesigns.brenniesdreamscape.com/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^http://www.dreamscapewebdesigns.brenniesdreamscape.com$      [NC]
RewriteCond %{HTTP_REFERER} !^http://www.dreamsoy.brenniesdreamscape.com/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^http://www.dreamsoy.brenniesdreamscape.com$      [NC]
RewriteCond %{HTTP_REFERER} !^http://www.gregandbren.brenniesdreamscape.com/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^http://www.gregandbren.brenniesdreamscape.com$      [NC]
RewriteCond %{HTTP_REFERER} !^http://createwithintent.com/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^http://createwithintent.com$      [NC]
RewriteCond %{HTTP_REFERER} !^http://dreamscapedirectory.com/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^http://dreamscapedirectory.com$      [NC]
RewriteCond %{HTTP_REFERER} !^http://dreamscapewebdesigns.com/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^http://dreamscapewebdesigns.com$      [NC]
RewriteCond %{HTTP_REFERER} !^http://dreamsoy.com/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^http://dreamsoy.com$      [NC]
RewriteCond %{HTTP_REFERER} !^http://gregandbren.com/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^http://gregandbren.com$      [NC]
RewriteCond %{HTTP_REFERER} !^http://lunarforums.com/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^http://lunarforums.com$      [NC]
RewriteCond %{HTTP_REFERER} !^http://www.createwithintent.com/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^http://www.createwithintent.com$      [NC]
RewriteCond %{HTTP_REFERER} !^http://www.dreamscapedirectory.com/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^http://www.dreamscapedirectory.com$      [NC]
RewriteCond %{HTTP_REFERER} !^http://www.dreamscapewebdesigns.com/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^http://www.dreamscapewebdesigns.com$      [NC]
RewriteCond %{HTTP_REFERER} !^http://www.dreamsoy.com/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^http://www.dreamsoy.com$      [NC]
RewriteCond %{HTTP_REFERER} !^http://www.gregandbren.com/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^http://www.gregandbren.com$      [NC]
RewriteCond %{HTTP_REFERER} !^http://www.lunarforums.com/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^http://www.lunarforums.com$      [NC]
RewriteCond %{HTTP_REFERER} !^https://dreamsoy.com/admin.php/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^https://dreamsoy.com/admin.php$      [NC]
RewriteCond %{HTTP_REFERER} !^https://www.dreamsoy.com/admin.php/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^https://www.dreamsoy.com/admin.php$      [NC]
RewriteRule .*\.(jpg|jpeg|gif|png|bmp)$ - [F,NC]
Logged
Dinu
Support
Intergalactic Superstar
*****
Offline Offline

Posts: 171


Learning Wordpress :)


« Reply #10 on: July 30, 2008, 10:32:53 AM »

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

did you try removing that line ?  Soooo Cool
Logged

Greetings !!!
Dinu
Brennie369
Spaceship Captain
*****
Offline Offline

Posts: 115



WWW
« Reply #11 on: July 30, 2008, 10:41:54 AM »

I just now tried it & no change, so I put it back.
Logged
MrPhil
Quantum Encyclopedia Writer
*****
Offline Offline

Posts: 3400



« Reply #12 on: July 30, 2008, 06:51:24 PM »

The fact that you removed the RewriteRule line (as suggested by Dinu) and you still got this error suggests that something very odd is going on. Removing that line (or commenting it out with #) should cripple hotlink protection and permit your images to be seen. It sounds like you're not correctly clearing your browser cache (perhaps you're clearing the browser history instead?). Try instead to bring up one of these pages and press Ctrl-F5 to force a page reload. If it works, you didn't correctly clear the cache.

First, you can cut the list in half by using (www\.)? in the pattern instead of separate "with and without www." versions. For example,

Code:
RewriteCond %{HTTP_REFERER} !^http://www.brenniesdreamscape.com/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^http://www.brenniesdreamscape.com$      [NC]
RewriteCond %{HTTP_REFERER} !^http://brenniesdreamscape.com/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^http://brenniesdreamscape.com$      [NC]

becomes

Code:
RewriteCond %{HTTP_REFERER} !^http://(www\.)?brenniesdreamscape\.com/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^http://(www\.)?brenniesdreamscape\.com$      [NC]

You should be able to further reduce that to

Code:
RewriteCond %{HTTP_REFERER} !^http://(www\.)?brenniesdreamscape\.com(/)?.*$      [NC]

but you said that didn't work for you. Oddly, it works fine for me.

I'm not sure that placing "RewriteEngine On" so far away is doing any harm, but you might try moving it to right before the first RewriteCond to see if that makes any difference (probably not).

If none of this helps, there could very well be a problem with your server's Apache configuration. Support will have to deal with that.
Logged

Brennie369
Spaceship Captain
*****
Offline Offline

Posts: 115



WWW
« Reply #13 on: July 31, 2008, 07:31:18 AM »

I do have support helping me on this as well but I get the impression they don't know what's going on either. They said they turned my ticket over to a support GROUP (or something like that). Support is the one that suggested all the lines for each domain (I thot it seemed cumbersome! I'd rather cut in in half).

Thanks for all the help!
Logged
fairywitch
Space Explorer
***
Offline Offline

Posts: 8


WWW
« Reply #14 on: July 31, 2008, 08:52:03 AM »

Just as an aside question. Brennie, are you on Tseen by any chance? I have a similar problem.
Logged
Pages: [1] 2   Go Up
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.6 | SMF © 2006-2008, Simple Machines LLC

Valid XHTML 1.0! Valid CSS! Dilber MC Theme by HarzeM