Posts Tagged ‘.htaccess’

Optimization: How to Lose Weight in the Browser

CSS, HTML, Optimization | Posted by Keefr March 18th, 2013

Love this in-depth article about optimizing your web properties. I have been a proponent of a lot of this already, but there’s some new things in here I want to try and/or incorporate.

How to Lose Weight in the Browser

Hat tip, Bret

How To Find The Full Path to a File Using PHP

PHP, Web Development | Posted by Keefr April 27th, 2012

Was going to write up a little piece on how to find the current file’s directory on a webserver, but the little article below does a good job of explaining it. I use this all the time for creating my .htaccess/.htpasswd combo, but can see other times when this would be useful as well.

I’ve adopted their code snippet for my own TextExpander time saving purposes:

How To Find The Full Path to a File Using PHP

.htaccess Tips and Tricks

Web Development | Posted by Keefr February 27th, 2012

Came across this two part article while looking for something else .htaccess related. This is a great reference and learning piece for all things .htaccess:

.htaccess Tips and Tricks

.htaccess Resources

How-Tos, Web Development | Posted by Keefr February 10th, 2012

I’ve spent a fair amount of time as of late working in Apache’s .htaccess files for a myriad of reasons — including improving Google Page Speed numbers, password protecting sites and redirects. Its contents are powerful and uber-useful.

Here are a few resources I’d recommend for learning more about .htaccess files’ power and abilities:

Read the rest of this entry »

Preventing Hotlinking

Web Development | Posted by Keefr June 3rd, 2011

I noticed a lot of people on Keefr.com’s sister site, Keefer Madness hotlinking to my images, especially in forums. It’s a bit annoying and steals my bandwidth. While not a major drain, I wanted to prevent this, and didn’t want to do it via another plugin within WordPress. Turned out, it was pretty simple.

RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www.)?keefermadness.com/.*$ [NC]
RewriteRule .(gif|jpg|js|css)$ - [F]

If the code is working and in place, the image reference I’ve put in below will not show the image.

Van Halen Logo from Keefer Madness.com

Found the rewrite code here. It’s all over the place, but that was the result I utilized.