301 redirect question

Discussion in 'Site & Server Administration' started by Skinny, Jan 12, 2006.

  1. #1
    Okay I don't have too much experience in editing .htaccess so please help.

    Write now I have implemented a 301 redirect from Cpanel.

    Here's the problem:

    I want url.com to go to www .url.com. However when I implement that in the Cpanel it works fine when someone types url.com but it times out if someone types www. url.com.

    Now the contents is a blog so there is php content. For now it's being redirected to www. url.com/index.php.

    How do I redirect to www. url.com/

    Thanks

    Skinny
     
    Skinny, Jan 12, 2006 IP
  2. Sorror

    Sorror Active Member

    Messages:
    376
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    60
    #2
    RewriteEngine On 
    RewriteCond %{HTTP_HOST} ^domain.com$
    RewriteRule ^(.*)$ http://www.domain.com/$1 [R=301,L]
    Code (markup):
     
    Sorror, Jan 12, 2006 IP
    Skinny likes this.
  3. Skinny

    Skinny Peon

    Messages:
    1,864
    Likes Received:
    93
    Best Answers:
    0
    Trophy Points:
    0
    #3
    So I replace domain with gazotto.

    I'm confused as how to write to the stupid thing.

    I:

    Download it. Make it .txt. Add that. Upload it. Rename it .htaccess.

    Is that correct.

    Skinny
     
    Skinny, Jan 12, 2006 IP
  4. Sorror

    Sorror Active Member

    Messages:
    376
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    60
    #4
    Yeap, and in this case it should be placed in the main directory.

    There is something wrong on Your site with that if You're asking now?
     
    Sorror, Jan 12, 2006 IP