Results 1 to 5 of 5

Thread: .htaccess Redirect

  1. #1
    Join Date
    Apr 2006
    Posts
    584
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default .htaccess Redirect

    Hi all... I know how to do a redirect to a new URL using a .htaccess file if I am pointing to a different server, however both domain.com and domain.com.cn are pointing to the same server, I just am wondering what I would add into my .htaccess file to get it to redirect from domain.com.cn to domain.com?

    I have tried this:

    Redirect permanent / http://domain.com

    Which works for the .com.cn, but once it reidrects to the .com it keeps redirecting and the browser freaks out and gives me the following:

    Too many redirects occurred trying to open “http://www.domain.com/”. This might occur if you open a page that is redirected to open another page which then is redirected to open the original page.

  2. #2
    Join Date
    Jan 2008
    Posts
    4,168
    Thanks
    28
    Thanked 628 Times in 624 Posts
    Blog Entries
    1

    Default

    Well, do you have a redirect on domain.com?
    Jeremy | jfein.net

  3. #3
    Join Date
    Apr 2006
    Posts
    584
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    They are on the same server so I am re-directing to .com and it keeps looping and looping

  4. #4
    Join Date
    Sep 2006
    Location
    St. George, UT
    Posts
    2,769
    Thanks
    3
    Thanked 157 Times in 155 Posts

    Default

    It shouldn't matter if they are on the same server, just as long as they are set up as separate virtual hosts. If that is not the case (the separate Virtual Hosts that is), then you could use PHP (or any other supported server side language) and have something like the following in your index page (or all the pages if you want):

    Code:
    <?php
     if (strstr($_SERVER['HTTP_HOST'], 'domain.com.cn')) {
       header('Location: http://www.domain.com');
     }
    ?>
    Not sure if you could do something equivalent using htaccess.

    Hope this helps.
    "Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music." - Kristian Wilson, Nintendo, Inc, 1989
    TheUnlimitedHost | The Testing Site | Southern Utah Web Hosting and Design

  5. #5
    Join Date
    Apr 2006
    Posts
    584
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    I want to use a .htaccess file if possible... I tried this and it kills both addresses:

    Options +FollowSymLinks
    RewriteEngine on
    RewriteCond %{HTTP_HOST} ^independentlycertifieddiamonds.com.au/ [NC]
    RewriteRule ^(.*)$ http://www.independentlycertifieddiamonds.com/$1 [L,R=301]
    I then tried this:

    This works for when the user types in .com.cn, but if they type in the .com it just keeps redirecting over and over to the same url and the server timesout

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •