301 .htaccess question..

Discussion in 'Apache' started by nando, Dec 4, 2007.

  1. #1
    Hey everyone - I've been doing some reading and I'm not sure of some things...

    What would be the best way to set a permanent redirect for a domain and all subpages?

    Example:

    www.old-domain.com redirects to www.new-domain.com

    and

    www.old-domain.com/page23.html redirects to www.new-domain.com/page23.html


    Also - if I have a domain pointing to old-domain.com/directory, would the domain now point to new-domain.com/directory or will it stay the way it is?

    Its being pointed by cpanel.

    Any and all help is appreciated, thanks in advance..
     
    nando, Dec 4, 2007 IP
  2. nando

    nando Well-Known Member

    Messages:
    1,250
    Likes Received:
    18
    Best Answers:
    0
    Trophy Points:
    140
    #2
    anyone wana help a brother out here...
     
    nando, Dec 5, 2007 IP
  3. powerspike

    powerspike Peon

    Messages:
    312
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Rewritecond %{http_host} ^sitearmory.com [nc]
    RewriteRule ^(.*)$ http://www.sitearmory.com/$1 [r=301,nc,l,qsa]

    replace "sitearmory.com" with your domain

    the qsa is importiant if you have stuff like ?q=we on your urls.
    that should do it for you.
     
    powerspike, Dec 5, 2007 IP
    nando likes this.
  4. nando

    nando Well-Known Member

    Messages:
    1,250
    Likes Received:
    18
    Best Answers:
    0
    Trophy Points:
    140
    #4
    replace with the new domain correct? If so, its not doing anything.. Would I be able to use a sub directory instead of a full domain.. i.e: domain.com/folder/ ?

    thanks for your help..
     
    nando, Dec 6, 2007 IP
  5. powerspike

    powerspike Peon

    Messages:
    312
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    0
    #5
    if you want to use a sub domain name, you'll have to use a different set of rules.

    but you'll have to tell us how you'll want it to work with folders ?
     
    powerspike, Dec 6, 2007 IP