RazorCreations


.htaccess rewrite case-insensitive

Posted in Development by Phil Jones on the April 28th, 2008

I came across a little bug the other day working with htaccess redirects.

I was trying to figure out redirects using the RewriteRule but found that the redirect only works if the rule is written in the same case as the redirect. For example :

RewriteRule Admin/ index.php
( if i type admin in the browser the redirect would 404 ).

After looking into the apache manual i found the no-case flag

‘nocase|NC’(no case)
This makes the Pattern case-insensitive, i.e., there is no difference between ‘A-Z’ and ‘a-z’ when Pattern is matched against the current URL.

The above rule could then be coded as :
RewriteRule Admin/ index.php [NC]

Quite a nice feature i wasn’t aware of.

xHTML : Abbreviation Tag <abbr>

Posted in Development by Phil Jones on the March 23rd, 2008

Over the past few months i have noticed a big increase in the use of the <abbr> tag, particularly on blogs.

Here is an example of sufficient use of the abbreviation tag:

It was 70 degrees Fahr. today!

By default Firefox cleverly produces a dotted underline for the abbreviated word ( in this case Fahr ). Unfortunately Internet Explorer and Safari doesn’t do this so we have to manually apply a style. There are several ways of doing this, a popular method is to use Javascript ( see here ) to automatically add a span to all <abbr> tags. I’m not a massive fan of this, i prefer to keep Javascript down to a minimum wherever possible.

I prefer a simple CSS approach,

abbr {
   border-bottom: 1px dotted;
   cursor: help;
}

This will add a nice dotted line beneath the abbreviated word and help cursor ( see right menu for example ).

The same styling can also be applied to the acronym tag for similar effect.