301 redirect help

Discussion in 'Apache' started by dcristo, Jan 1, 2007.

  1. #1
    I currently have this in my .htaccess file:

    
    RewriteEngine On
    RewriteCond %{HTTP_HOST} ^domain.com [nc]
    RewriteRule (.*) http://www.domain.com/$1 [R=301,L]
    
    Code (markup):
    The problem is, I want the domain to redirect to the www version when in this format:

    http://domain.com/directory/ to http://www.domain.com/directory/

    It currently just redirects to http://www.domain.com/index.php when you try and access any version of the non WWW version. (instead I just want the WWW version of the same URL)

    Hope that makes sense :)
     
    dcristo, Jan 1, 2007 IP