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.

June 25th, 2008

Top 10 Firefox 3 Features
I was looking for a way to delete a link from the so called “awesome bar” in the Firefox 3 web browser. On a Mac, you select the link you wish to remove and press shift delete. On Windows you only have to press delete. Then I did a google search and found this Lifehacker article.

June 18th, 2008

33 New Places to Get Design Inspiration
Freelanceswitch.com offers up 33 sites for design inspiration overload! So check ‘em out to get your design groove on…

Band - Definitely an iPhone winner.

June 9th, 2008

The developer of Band, Mark Terry of Moo Cow Music, is gonna be rich. This is a great little application for musicians and non-musicians alike!

Looks like a great application to use as a scratchpad for song ideas while you are out and about town.

Now if he could just get a decent web page design going….

June 4th, 2008

Saving the Spark: Developing Creative Ideas
Ideas are at the heart of every creative process. However, coming up with them can be hard work. Mark Boulton arms us with tools to meet this challenge.” From your friends at A List Apart. Be sure to read the article on “Writing an Interface Style Guide” by Jina Bolton as well. Good stuff.

June 4th, 2008

Zoomable 5 Gigapixel image of the Milky Way
the Spitzer Space Telescope created a 180-foot-long mosaic of 800,000 high-resolution snapshots” of the galaxy. Simply awesome.