[UPHPU] httpd.conf RedirectPermanent
Justin Hileman
justin at justinhileman.info
Tue Apr 7 07:37:39 MDT 2009
Brandon Stout wrote:
>
> I also have a couple of personal reasons for redirecting in general,
> whatever the method:
>
> * It's my private retribution to people who don't listen. If I say
> 'mscis.org', I mean 'mscis.org', not 'www.mscis.org'. People who type
> the www in front get the www taken away. The only improvement would be
> for a voice recording to say "did I say to put 'www' in front? Let me
> fix it for you".
> * People should lose the www in front of all domains. The fact that
> they are asking for the domain on port 80 or 443 means they are seeking
> for web content. You don't need the www to tell the server to give web
> content. Perhaps a few cases call for enforcing the www, but I think
> most cases, you can throw them out. Either way, I can force it to go
> the way I need it to go.
I redirect for all the same reasons. I generally do it in an .htaccess
file, though, because that's easy to deploy on any site, in any hosting
invronment--shared or not. Here's my weapon of choice:
<IfModule mod_rewrite.c>
# Canonical domain name rewrite
RewriteCond %{HTTP_HOST} !^justinhileman\.info$ [NC]
RewriteRule (.*) http://justinhileman.info/$1 [L,R=301]
</IfModule>
Note that this redirects *any* URL on the domain, not just the base URL.
So if I tell someone to visit 'justinhileman.info/archive' and they
decide to prepend a www, it will still strip it out. It does deliver
everyone to their intended destination, unlike other variations I've
seen, thanks to the $1 in the rewrite rule.
--
justin
http://justinhileman.com
More information about the UPHPU
mailing list