-2

I need to redirect a domain that does not have any content to another domain that is working. I have GoDaddy hosting.

  • Domain 1: www.example-one.net: No content, just the domain.
  • Domain 2: www.example-two.com: Working website.

I want www.example-one.net/index.php/?query=value to redirect to www.example-two.com/value

How can I do this?

4
  • What have you tried? Are both domains on the same account / pointing to the same place on the file system?
    – MrWhite
    Sep 22, 2016 at 10:38
  • yes. both domain are on same account. i don't know how to point domain. Sep 22, 2016 at 12:37
  • Is there any tutorial for the same. hope you are getting my requirment Sep 22, 2016 at 12:38
  • There is nothing wrong in text typo. please don't edit. Thanks Sep 24, 2016 at 4:58

1 Answer 1

1
www.domain1.com/index.php/?query=value

In the .htaccess file in the document root, try the following:

RewriteEngine On
RewriteCond %{HTTP_HOST} =www.domain1.com [NC]
RewriteCond %{QUERY_STRING} ^query=(\w+)
RewriteRule ^index\.php$ http://www.domain2.com/%1 [R=302,L]

This assumes that value consists of just "word" characters (ie. A-Z, a-z, 0-9 and _). Also, query= must appear at the start of the query string (as in your example).

This is also a 302 (temporary) redirect. You should probably change this to 301 (premanent) when you are sure it's working OK. 301s are cached by the browser, so can make testing problematic.

1
  • Thanks for your kind reply. But this solution is for single domain redirect. My hosting have two domain. Among them , one domain has content i.e. one can see website and other domain has no content for now i.e. one can not see website. Sep 24, 2016 at 4:53

Not the answer you're looking for? Browse other questions tagged .