Jill and Mark at FleetThought are life savers! As a small, rural
library director where I *am* the IT staff, I was at a loss as to how to
customize my library's website template. Jill and Mark made my small
site feel like such a priority, and I got first class service! They
listened to my needs and made many changes I requested to make my site
beautiful and to make me a happy customer. I am so grateful for their
expertise and I cannot recommend them enough!
In a site I was recently working on, I found myself hard-coding links to files stored within my Drupal site's "files" directory. If you've ever coded these links before, you know that they normally look something like:
/sites/[sitename]/files/[someotherdirectory]/image.jpg
This can be somewhat painful to add to the site, especially if you have any plans to ever change the domain name of your site. It would really be ideal if you could leave the domain name out of the equation and just write the link in the format:
/files/[someotherdirectory]/image.jpg
This is actually possible to do using the .htaccess file that appears in the root of your Drupal installation. Basically you just need to add a single line:
RewriteRule ^files/(.*)$ /sites/%{HTTP_HOST}/files/$1 [L]
After you implement this rule, you should be able to start writing simpler links to your "files" directory.
Happy coding!




