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

Momin Iqbal
  • 11
  • 1
  • 3

1 Answers1

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.

MrWhite
  • 11,643
  • 4
  • 25
  • 40
  • 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. – Momin Iqbal Sep 24 '16 at 04:53