• wondering if Cox is blocking or limiting Netflix streaming. Now it won't play at all.
    You should follow me on twitter here

Category: Rants

Redirect directory to index page

July 1st, 2008

I was recently asked by a client to redirect all pages in a directory to the directory index page. They were ending a co-branding service with another company. What they wanted was to keep only a re-worked index page in the directory as being visible, but not show people who may have bookmarked other pages in this directory the 404 page.

I searched and searched Google for this and couldn’t find exactly how to do this via .htaccess anywhere. I found similar information, such as how to redirect from directory to directory, but not how to redirect all pages to just one page in the same directory. After some trial and many errors, I figured it out.

So here I post my .htaccess for posterity, and my own need. Hope this helps others as well.

RewriteEngine On
# don't redirect .css, .jpeg, .jpg, .png or .gif extensions
# the extensions are separated by a pipe ("|")
RewriteRule \.(css|jpe?g|png|gif)$ - [L]
# if the request isn't for index.php then
# redirect to index.php
RewriteRule !^index\.php$ /index.php [R=301,L]

**NOTE: if this is a temporary redirect, you can substitute this for the last line:

RewriteRule !^index\.php$ /index.php [L]

The line RewriteRule \.(css|jpe?g|png|gif)$ - [L] is used so that image and css calls are not redirected.

So basically this will take any page called for in http://www.example.com/something/ and redirect it to http://www.example.com/something/index.php as long as the .htaccess file is in the /something directory.

Images disappear in IE6

March 11th, 2008

Yes, I, like most of you, still put up with ie6 and its plethora of CSS bugs. I tend to forget the easiest fix can sometimes just be

position:relative;.

I just fixed a problem I had regarding an image floating to the left of some text. The problem was that the image just wouldn’t show up in ie6. I tried the clear float solution, but to no avail. Then I remembered another solution concerning images, floats and ie6 :

img {position: relative;}

Works like a charm.

From Community MX: How To Attack An Internet Explorer (Win) Display Bug

It turns out that applying a simple {position: relative;} to the negatively margined inner box causes the missing portions to magically reappear. Why? Well, moving right along… Seriously, no one knows why this happens, except perhaps the Microsoft engineers, and they aren’t talking. Suffice to say it does work.

Soon, this fix was found to work on other IE bugs as well, specifically the Peekaboo Bug in IE6 (look on the third page of the article). We’ll get back to the Peekaboo bug in just a little while.

Another primary use for this fix is occasioned when a floated image is in a container and either the container or the floated image has been made “relative.” In that case, the floated image can and will “hide” behind any background that may be placed on the outer container element. Removing the relative positioning or making both elements relative will bring the floated image “up front,” allowing it to be seen.

PC to iMac networked printer

February 12th, 2008

On your PC, and need use a networked printer that is installed on your iMac? I found the easiest way is to install Apple’s Bonjour for Windows. After installing, use the Bonjour Printer Wizard, it’s simple and easy! It found my Epson, which I was having trouble with, right off and connected in seconds.