Page is a not externally linkable
- Code, Content, and Presentation
-- Apache Web Server
---- Mod Rewrite Anti-Leech (A Better Version)


jdMorgan - 1:36 am on Feb 2, 2005 (gmt 0)


The 2nd ReWrite rule does actual work, I have tested it. If someone links directly to an image it will redirect them to a html or php page. Which is a good option becuase you can redirect to your homepage. Which is a kind of seemless background approach.

What happens if an image search engine picks up that link and follows it? It makes a mess. And if the image is hotlinked, then the browser can't handle it properly... Browsers can't handle a redirect to an HTML page from an <img src=...> link.

The only downside to the 2nd ReWrite rule, is that if they embed the image, it produces a broken image icon, unlike the 1st method which does the substitution.

I don't fool around with wasting bandwidth on other sites. That's their problem. I prefer to serve up a simple, short, 403-Forbidden response, and worry about other more important things.

Just regarding the trailing ".*" sub-patterns, I'm just cautiously wonderring why that was added by the generator? If it's there for a reason that we've overlooked?

No. It is there because the generator or its author are taking the easy route, and not fixing the special case.
Avoid ".*" whenever possible. It is the greediest and most-ambiguous pattern, and therefore, the least effcient to process. Leading "^.*" and ".*" and trailing ".*$" and ".*" patterns are a waste of space and CPU time.

You can use a generator to get started, but don't count on automation for quirk-free, efficient code.

Jim


Thread source:: http://www.webmasterworld.com/apache/2783.htm
Brought to you by WebmasterWorld: http://www.webmasterworld.com