[Nfb-web] .htaccess URL rewrites

Michael Hansen mhansen4 at gmail.com
Sun Mar 1 09:33:13 UTC 2009


Just thought I would share something I was playing with tonight. In
the end I got it to work and thought it was cool.

Since it's inception the Nebraska affiliate website has had 8
different URLs that could be used to hit it's website. Some of these
are just a matter of including or excluding the www at the front of
the URL and others are complete changes to the domain name. These came
about because of 3 major changes in the history of the website. First
was a change in the type of account we had with our ISP back around
1998. Second was a change our ISP made in its domain name. Finally was
our recent change to using the "www.ne.nfb.org" domain name.

Needless to say we are linked to using many different names and stored
in favorites using many different names. To try and start to put a end
to this I was able to put some entries in our hosting accounts
.htaccess file for each of the posibilities that rewrites the URL that
was used to "www.ne.nfb.org". It also tells the refer or web browser
that this is a permanent change. I am told that doing this will cause
most web browsers to update the stored bookmark info.

The code looked something like this:

Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^nfbn.inetnebr\.com$ [NC]
RewriteRule ^(.*)$ http://www.ne.nfb.org/$1 [L,R=301]
RewriteCond %{HTTP_HOST} ^nfbn.inebraska\.com$ [NC]
RewriteRule ^(.*)$ http://www.ne.nfb.org/$1 [L,R=301]
RewriteCond %{HTTP_HOST} ^ne.nfb\.org$ [NC]
RewriteRule ^(.*)$ http://www.ne.nfb.org/$1 [L,R=301]


Any way just thought I would share.
---
Mike Hansen
NFB of Nebraska




More information about the NFB-Web mailing list