Need help with 301 redirect, $15

Discussion in 'Apache' started by Jim_Westergren, Jun 13, 2006.

  1. #1
    I cannot figure out the solution for a client.

    He has a site on name1.name2.com and want the domain including all the internal pages to be redirected to www.name2.com.

    I told him to put the following in the .htaccess:

    RewriteEngine On
    RewriteCond %{HTTP_HOST} !^name1.name2.com$ [NC]
    RewriteRule ^(.*)$ http://www.name2.com/ [R=301,L]

    He tried it but gets the following message:

    What do i do?

    I pay $15 to the one that solves it, thanks!
     
    Jim_Westergren, Jun 13, 2006 IP
  2. mad4

    mad4 Peon

    Messages:
    6,986
    Likes Received:
    493
    Best Answers:
    0
    Trophy Points:
    0
    #2
    RewriteCond %{HTTP_HOST} ^name1.name2.com
    RewriteRule (.*) http://www.name2.com/$1 [R=301,L]

    or

    RewriteCond %{HTTP_HOST} name1.name2.com
    RewriteRule (.*) http://www.name2.com/$1 [R=301,L]

    Or try adding Options +FollowSymLinks to the top of the htaccess.
     
    mad4, Jun 13, 2006 IP
  3. Jim_Westergren

    Jim_Westergren Notable Member

    Messages:
    1,882
    Likes Received:
    247
    Best Answers:
    0
    Trophy Points:
    235
    #3
    Jim_Westergren, Jun 13, 2006 IP
  4. legend2

    legend2 Well-Known Member

    Messages:
    1,537
    Likes Received:
    74
    Best Answers:
    0
    Trophy Points:
    115
    #4
    not sure jim, but did you try:

    your condition was saying !^name1.name2.com$ i.e. the http host is not that subdomain


    RewriteEngine on
    RewriteCond %{HTTP_HOST} ^name1\.name2\.com
    RewriteRule ^(.*)$ http://www.name2.com/$1 [R=301,L]
     
    legend2, Jun 13, 2006 IP
  5. Jim_Westergren

    Jim_Westergren Notable Member

    Messages:
    1,882
    Likes Received:
    247
    Best Answers:
    0
    Trophy Points:
    235
    #5
    I have sent 4 versions to the client to test. Let's see tomorrow if it works for him. I'll let you know.

    Thanks a lot.
     
    Jim_Westergren, Jun 13, 2006 IP