How to redirect just the top page of a dynamic site

I need to have the top page of a dynamic site that uses index.php, redirect to another site, different name, different server. I need to have the pages underneath remain the same.

So, I have a site
Pages underneath are:

Who is Participating?
Steve BinkCommented:
The easiest way would be to put code at the top of index.php to detect the querystring.  If none is found, use header() to redirect to the alternate location, otherwise continue execution.  See the code snippet for an example.

You can also do this with mod_rewrite.  Use RewriteCond to check for the querystring content.  A very basic example:

# if no query string exists, redirect
RewriteCond %{QUERY_STRING} !^.+$
RewriteRule .* [R,L]
if (count($_GET)<1) {
  // no data in the querystring

Open in new window

what is the condition for the redirect?
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.