htaccess redirect *.domain.com to www.domain.com/index.php

Posted by decimal on Stack Overflow See other posts from Stack Overflow or by decimal
Published on 2010-05-15T18:56:39Z Indexed on 2010/05/15 19:04 UTC
Read the original article Hit count: 365

Filed under:

I want to redirect a user to www.domain.com/index.php if they type in either: domain.com or www.domain.com. I'm clueless about htaccess. Here's what I found but I don't know how to write an OR statement for the www. redirect

RewriteEngine on
RewriteCond %{HTTP_HOST} ^domain\.com
RewriteRule (.*) http://www.domain.com/index.php$1 [R=301]

© Stack Overflow or respective owner

Related posts about mod-rewrite