icon Get the most out of Surmunity, read our tips here! Need an interesting blog to read? You've got to read the Surpass Blog! | Welcome! Please register to access all of our features.

» Surpass Web Hosting Forums » Choosing Surpass » Signed Up? » Image linking help

Signed Up? If you're new with a question, ask here!

Reply
 
LinkBack Thread Tools Search this Thread
Old November 21st, 2007, 1:52 PM   #1 (permalink)
JMF
Registered User
Seasoned Poster
 
JMF's Avatar
 
Joined in Jun 2004
Lives in Tennessee, USA
Hosted on Pass56
36 posts
Gave thanks: 1
Thanked 1 Time in 1 Post
Image linking help

Hi,

I'm hooking an Amazon.com aStore into my web site, but I'm having image problems -- it's using an iframe do drop the store into one of my page templates, and I can modify the CSS to some extent.

Since the store page section is actually coming through Amazon's site, though, I have to link to my images in the CSS externally, i.e. http://www.ferrellweb.com/images/darkgradient.gif -- that image will pull up fine if you enter the address directly in a web browser, but produces a "Forbidden" error in code.

I'm pretty sure I've got hotlink protection turned off, and the directory isn't password protected or anything... any suggestions as to what else I should check to get my images to show up?

Thanks!
JMF is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old November 22nd, 2007, 12:23 AM   #2 (permalink)
Registered User
Fresh Surpasser
 
Joined in Sep 2006
Hosted on Gotti
10 posts
Gave thanks: 1
Thanked 0 times
You may wish to look at your .htaccess file on your site for something like this:

Code:
RewriteEngine on
   ---
RewriteCond %{HTTP_REFERER} !^http://(.+\.)?yourothersitesite\.org/ [NC] [OR]
RewriteCond %{HTTP_REFERER} !^http://(.+\.)?yoursite\.org/ [NC]
RewriteCond %{HTTP_REFERER} !^$
RewriteRule .*\.(jpe?g|gif|bmp|png)$ /image/nohotlink.jpe [L]
The RewriteCond containing "yoursite" and the RewriteCond below it and the RewriteRule were taken straight out of my site's .htaccess file, where I replaced my domain name with "yoursite" and left the rest untouched.

To use this on your site, put your site address in place of "yoursite\.org" -- and include the \. sequence in place of the . in your name.

These bottom two RewriteConds will exclude visitors to your site from another page on your site and visitors who visit your site directly from the hot-linking rule below. In other words, they will be able to see your site's images.

Now, I have copied the "yoursite" line and pasted it above the original one and put the substitute "yourothersite" in the place of the domain name.

You may have to experiment with this, but start with your Amazon page that is trying to hotlink to your site, and if necessary, add more copies of "yourothersite" with additional excluded addresses from your store link.

In the end, you have hot-linking turned on for everyone except visitors to your site from direct access, visitors to your site from another page on your site and visitors (the iframe) from your store page.

Now, after using direct editing of your .htaccess and subsequently trying to use your cpanel features that write to the .htaccess, cpamel may wipe out your direct edits, so I would back the .htaccess up on your home computer.

Then you can add the new code created with cpanel to the existing file and send it back up to the server, if cpanel erases your manual changes.

Since this is an experiment, you may wish to back-up your current .htaccess before adding these edits to it.

I use .htaccess in Windows on my Apache server, which I have configured with all the features of the Linux Apache serving my site on Surpass Hosting. My MetaPad (a NotePad replacement) does let me save .htaccess without calling it .htaccess.txt or otherwise forcing me to jump through hoops to save .htaccess on Windows. Most third-party editors will bypass that Windows limitation that "you must type a file name."

[Edit to add this]
I should have mentioned that the ... line in the code just infers that there may be other Rewrite conditions-and-Rulesets between the RewriteEngine on and these rules. [/edit]

Last edited by Larry_Kuck; November 22nd, 2007 at 12:28 AM. Reason: Clarification
Larry_Kuck is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old November 22nd, 2007, 8:13 AM   #3 (permalink)
JMF
Registered User
Seasoned Poster
 
JMF's Avatar
 
Joined in Jun 2004
Lives in Tennessee, USA
Hosted on Pass56
36 posts
Gave thanks: 1
Thanked 1 Time in 1 Post
Hey, thanks! It looks like it's working now!
JMF is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old November 22nd, 2007, 1:15 PM   #4 (permalink)
Registered User
Fresh Surpasser
 
Joined in Sep 2006
Hosted on Gotti
10 posts
Gave thanks: 1
Thanked 0 times
One quick follow-up on this RewriteRule:

RewriteRule .*\.(jpe?g|gif|bmp|png)$ /image/nohotlink.jpe [L]

People who try to steal one of your images will be sent the file called, "nohotlink.jpe," which is located in your image directory.
Create a nohotlink.JPG and rename it to the .jpe extension.

The only drawback that I saw to redirecting to this nohotlink image was that Internet explorer, the great and wonderful browser that it is, displayed the nohotlink image in place of my background images in a search engine cache copy of my page, thus cluttering up that view of my page!
All the other browsers displayed the background images as intended in the cache copy.....
Larry
Larry_Kuck is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On