Results 1 to 5 of 5
  1. #1
    Join Date
    Oct 2006
    Posts
    323

    .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?

  2. #2
    Join Date
    Apr 2003
    Location
    San Jose, CA.
    Posts
    1,622
    It wouldn't be any different with both domains being on the same server.

    Easiest way is to edit domain.com.cn virtualhost entry or .htaccess file and:
    Redirect permanent / http://domain.com
    Daved @ Lightwave Networking, LLC.
    AS1426 https:/www.lightwave.net
    Primary Bandwidth: EGIHosting (NLayer, NTT, HE, Cogent)
    Xen PV VPS Hosting

  3. #3
    Join Date
    Oct 2006
    Posts
    323
    I tried that but it doesn't work the main domain.com keeps redirecting on itself in a loop and you get this error on the web page:

    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.

  4. #4
    Join Date
    Apr 2003
    Location
    San Jose, CA.
    Posts
    1,622
    Oh... you probably have both going to the same document root...
    so it's reading the same .htaccess file each time.

    Either put that in the virtualhost directive area for domain.com.cn, or change to using an actual mod_rewrite rule:

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

    RewriteCond %{HTTP_HOST} ^domain\.com\.cn$
    RewriteRule (.*) http://domain.com/$1 [R=Permanent]
    Daved @ Lightwave Networking, LLC.
    AS1426 https:/www.lightwave.net
    Primary Bandwidth: EGIHosting (NLayer, NTT, HE, Cogent)
    Xen PV VPS Hosting

  5. #5
    Join Date
    Oct 2004
    Location
    Kerala, India
    Posts
    4,750
    If what lightwave said did not work out, make the document root of the domain.com.cn as a subfolder and add a .htaccess with the rule given in the first reply. It should work.
    David | www.cliffsupport.com
    Affordable Server Management Solutions sales AT cliffsupport DOT com
    CliffWebManager | Access WHM from iPhone and Android

Posting Permissions

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