Therefore, we can add the argument and shorten the whole link to:
If you look at the URL of the page you're reading right now,
you'll likely see that the same trick was used to create this page.
The URL of this page is:
http://www.webmastersguide.com/?htaccess-cgi/picssi.htm
Actually though, the full URL is:
http://www.webmastersguide.com/index.shtml?htaccess-cgi/picssi.htm
The index.shtml can be left out. In this case, I use the variable as
the frame source for the bottom half of this page, rather than an img source.
So let's say you already have a big site the has all of the image links
already made. You could download Shotgun from our downloads page and
use it to change all the links. That's the method I prefer.
You can also let the server do this for you if you have mod_rewrite installed.
Simply leave you're image links alone and place the following text into
a file called .htaccess, which you then upload (as ASCII) into your /pics directory:
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^http://yourdomain.com/pics.shtml [NC]
RewriteRule [^/]+\.(gif|jpg)$ http://yourdomain.com/pics.shtml?%{REQUEST_URI} [L,R]
This way the server automatically reroutes links to individual pictures,
istead it returns the pics.shtml page with the picture planted in the
middle of it.
Caveat - Many webmasters seem to have a lot of trouble getting
any kind of .htaccess directives to work right, so you may just change the links
using your favorite search and replace program, such as Shotgun.