301. How?

Discussion in 'Apache' started by fryman, Jul 4, 2005.

  1. #1
    I don't know why, but google has over 6,000 indexed pages of domain.com and only 50 for www.domain.com

    So, I want to do a redirect from www.domain to just domain. How do I do it?


    The normal redirect for www.domain to domain would be

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

    What do I need to change to make it go the other way round?
     
    fryman, Jul 4, 2005 IP
  2. nddb

    nddb Peon

    Messages:
    803
    Likes Received:
    30
    Best Answers:
    0
    Trophy Points:
    0
    #2
    RewriteCond %{HTTP_HOST} ^www\.domain\.com
    RewriteRule ^(.*)$ http://domain.com/$1 [R=permanent,L]


    I think, but I could be wrong. Only take a second to try it though.
     
    nddb, Jul 4, 2005 IP
    digitalpoint likes this.
  3. fryman

    fryman Kiss my rep

    Messages:
    9,604
    Likes Received:
    777
    Best Answers:
    0
    Trophy Points:
    370
    #3
    yeah, that worked, thanks
     
    fryman, Jul 4, 2005 IP