homepage Welcome to WebmasterWorld Guest from 54.237.98.229
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
What exactly does this php redirect do?
PeaceKeeper



 
Msg#: 4664461 posted 10:07 pm on Apr 19, 2014 (gmt 0)

I was checking my backlinks in ahref.com today and noticed a redirect to my site from a Russian domain.

http://someevilrussiansite.ru/go.php?http://mywebsite.com/wp-content/uploads/2008/05/reallycoolpicture.jpg

Ahref.com says its a 301/302 redirect. What's he trying to do and is it harmful to my website?

Oh I have since changed the image name and put this in my .htaccess not sure if this will stop the redirect from showing up though:



RewriteEngine on

RewriteCond %{HTTP_REFERER} !^$

RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?mywebsite.com [NC]

RewriteRule \.(jpg|jpeg|png|gif)$ http://some-random-image-22.png [NC,R,L]

 

penders

WebmasterWorld Senior Member penders us a WebmasterWorld Top Contributor of All Time 5+ Year Member Top Contributors Of The Month



 
Msg#: 4664461 posted 11:01 pm on Apr 19, 2014 (gmt 0)

Quick guess... looks like they might be hotlinking your reallycoolpicture but avoiding passing any possible "link juice" to your site, by using an intermediary script (go.php).

If you were to (naively) publish your "top referers" then by also appearing as a (popular) referer in your logs then they stand a chance of getting some free linkage back to their site.

It might not be harmful, however, it's not doing you any favours either. They are using your content and bandwidth.

Your RewriteRule (as you have posted) is actually invalid. But it looks like an attempt to redirect any external request for an image (whether it exists or not) to another image. The hotlink/redirect still exists and your bandwidth is still being used.

lucy24

WebmasterWorld Senior Member lucy24 us a WebmasterWorld Top Contributor of All Time Top Contributors Of The Month



 
Msg#: 4664461 posted 1:04 am on Apr 20, 2014 (gmt 0)

I kinda suspect a typo, where you forgot to put /www.example.com/ (your own site) in the target. But don't use a redirect in this situation. Instead rewrite to your no-hotlinks image: leave off the [R] tag.

!^http(s)?://(www\.)?mywebsite.com

I did this for years before figuring out it's wrong. Assuming you have a single preferred form of your domain name, that's the only form that should appear in a hotlinking condition. If your site is http://www.example.com and someone comes in claiming "https://EXAMPLE.COM sent me", they're obviously lying in their teeth and should be blocked. Or rewritten.

PeaceKeeper



 
Msg#: 4664461 posted 8:55 am on Apr 20, 2014 (gmt 0)

Thanks for the replies. So it sounds like there's not much I can really do because the redirect link will still exist. Im not to worried about the resources it's using cause I doubt many people are actually seeing it. I'm just more worried about the SEO implications if there are any. Such as does Google think this Russian domain is my site and I'm trying to pass link juice onto this other site by doing this redirect.

penders

WebmasterWorld Senior Member penders us a WebmasterWorld Top Contributor of All Time 5+ Year Member Top Contributors Of The Month



 
Msg#: 4664461 posted 9:51 am on Apr 20, 2014 (gmt 0)

It's them who are issuing the redirect - so there's not much you can do about that (except from blocking or interfering with the request at your end, which is what your .htaccess script is doing.)

If this is just a one-off, low traffic "link" then it's unlikely to have any negative SEO consequences - even if the site is unsavoury. But if it's not passing "link juice" ie. "go.php" is blocked from crawlers, then it shouldn't even be seen by Google. Does this appear in Google's backlink report as well? Does ahref.com (do you mean ahrefs.com?) honour robots.txt?

If you do find you have harmful links to your site that are out of your control then Google has a "Disavow Links Tool" that permits you to discount these backlinks from its ranking algorithm.

Have you tried tracing this link back to its source to see the context in which it is used?

jay5r

5+ Year Member



 
Msg#: 4664461 posted 11:04 pm on Apr 21, 2014 (gmt 0)

For starters it's not a PHP redirect - it's an Apache mod_rewrite rule.

The biggest problem is that last line is broken - it will redirect to a bad URL. But if that were fixed, what the rule is supposed to be doing is serving one particular image for all images in the directory when it detects a hotlink (as defined by a referrer that's not from your site).

penders

WebmasterWorld Senior Member penders us a WebmasterWorld Top Contributor of All Time 5+ Year Member Top Contributors Of The Month



 
Msg#: 4664461 posted 11:42 pm on Apr 21, 2014 (gmt 0)

For starters it's not a PHP redirect - it's an Apache mod_rewrite rule.


@jay5r: I think you might have skipped the first half of the question?

lucy24

WebmasterWorld Senior Member lucy24 us a WebmasterWorld Top Contributor of All Time Top Contributors Of The Month



 
Msg#: 4664461 posted 1:25 am on Apr 22, 2014 (gmt 0)

We're in the php forum. It may have been a mistake on the OP's part; Apache and PHP are side by side in the subforums list.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved