php site - modifying .htaccess for mirror site redirect

Discussion in 'Apache' started by northpointaiki, Jan 2, 2006.

  1. #1
    Hi all -

    My newest site is a php-based site. All that is in the root directory .htaccess is:

    DirectoryIndex index.php


    I would like to do a redirect so that all http://domain.com queries resolve to http://www.domain.com.

    This site is an "add-on" domain to my other site - shares resources, but is otherwise completely separate. My other site uses front page extensions (I know, next time...), and I had to modify the _vti_bin and .htaccess files to allow Options +FollowSymLinks, then the root directory redirect code looks like this:

    # -FrontPage
    IndexIgnore .htaccess */.??* *~ *# */HEADER* */README* */_vti*
    <IfModule mod_rewrite.c>
    RewriteEngine on
    Options +FollowSymLinks
    RewriteBase /
    RewriteCond %{HTTP_HOST} ^domain.com [NC]
    RewriteRule ^(.*)$ http://www.domain.com/$1 [L,R=301]
    </IfModule>

    - which works fine. I am a bit wigged out by the php .htaccess only having "DirectoryIndex index.php" in it...

    Can someone please advise how to modify the .htaccess to get this redirect? Thanks.
     
    northpointaiki, Jan 2, 2006 IP