Forum Moderators: phranque
[domainname.com...]
[domainname.com...]
are rendered without any images, while
[domainname.com...]
[domainname.com...]
are served fine. The access log shows error 403 Forbidden for trailless URLs.
When hotlinking is enabled, all is fine.
The issue is, the tech support at the hosting company are incompetent scum. They first clandestinely enabled hotlinking (so that it still appeared disabled in the control panel), and that was "fine" for a while, but then I've noticed the parasite traffic.
Then they tried to redirect trailless URLs to ones with the trailing slash. That first crashed the website, all URLs returning the 500 error message. When they fixed that, I began getting dozens of error messages about "the maximum number of redirects being reached".
Now these clowns claim that the problem is in my code, and they don't have to work on it, and they worked on it in the first place as a personal favor to me, but since I did not like what they did I should not bother opening trouble tickets anymore.
This is an Apache server, and the issue seems in malconfiguration. The server sees the trailless URLs as "foreign" and drops all the images. Does anybody know anything about that? Or any solutions? The htaccess file does not contain anything other than the usual hotlinking disabling and IP banning stuff.
Thanks!
The trailing / problem is answered in this thread, Msg #3:
[webmasterworld.com...]
If that causes problems, you will have to post some of your code, because that would indicate a conflict somewhere.
Justin
Added:
Oops Forgot!
Welcome to WebmasterWorld. =)
(I'm tired too.)
htaccess at present says
Options -Indexes
order allow,deny
allow from all
deny from 65.55.124.43
But the thing is, hotlinking is not disabled here, as the scum had covertly enabled it again to get rid of me. I am in the process of forcing them to re-enable it, and then I'll see how they do that.
Have a look around here [google.com] for anti-hotlinking code that you can manually place in your .htaccess file; This will avoid the whole problem of control-panel-generated code.
Jim
RewriteEngine on
RewriteCond %{REQUEST_URI}!(/$¦\.)
RewriteRule (.+) http://www.example.com/$1/ [R=301,L]
Rule: if the requested location has 1 or more characters that are not the end of a line, and the location pattern qualifies for the condition, send them back to the location and add a /.
Condition: if the requested URI does not end in a / (/$) OR contain a litteral .(dot) (\.) process the rule.
Justin
Thanks jdMorgan - I love copy and paste =)
1) indeed, the control panel must be the issue and generate bad code (I can not check what it is as the scumbags are still non-responsive to my request to disbale hotlinking);
2) indeed, I can put "good" code into htaccess myself and see how it works.
Here are some questions:
1) If I format htaccess in Notepad, can it create some problems because of CR/LF things? The htaccess I have now has ~ signs between lines if I open it in Notepad; as I don't have any UNIX-type text editor, I'll have to do it Windows-style.
2) All the redirect solutions frighten me because that is what the tech support already did and it resulted in tons of "maximum number of redirects reached" messages. I understand that the final solution will do a redirect from URLs pointing directly to images to the URL pointing to a "get lost" message, and that's fine. I am reluctant, though, to do a redirect for any URL without a trailing slash, as there will be many people coming through such URLs, and this may generate all the error messages again.
3) I looked at that link to Google search results, read some pages, got even more tired - please don't see it as laziness, but would anybody be so infinitely kind as to directly post the code that riderects "image" URLs to an error page? I mean, it's all out there, but it will take a lot of time to read all that and I may bump into not so good solution in the end.
Thanks!
Addressing your questions:
1) If you have MS Word, use the option to "Save As" when saving. Select "Other Enconding - US ASCII" and "End Lines with - LF Only" to get Unix line-enders. After you've done that once to "clean up" the line enders, you can subsequently use Notepad or WordPad to edit the file.
2) "Maximum number of redirects exceeded" was one of the indicators that your host and/or control panel wrote some bad code. If fact, an external redirect is not required in most simple referrer-based anti-hotlinking solutions. Instead, an internal rewrite or 403-Forbidden error response is used.
3) Code sample: [webmasterworld.com...] msg#4
Jim