Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3622802
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T23:18:17+00:00 2026-05-18T23:18:17+00:00

I am not familiar with php and want to write a redirect script using

  • 0

I am not familiar with php and want to write a redirect script using php (The server I am working on does not support asp)

I think it needs to be something like this

<?php if ($_GET[id]; == 'test') {echo '<meta http-equiv="refresh" content="0;URL=http://www.test.com" />'} ?>

I want to send a query string like http://www.domain.com?id=test then the page should redirect to http://www.test.com or a query like http://www.domain.com?id=example and it shoud redirect to http://www.theexamplesite.com

Using javascript and classic asp I would have done it like this:

<% if (Request.QueryString("id") == 'test') { %><meta http-equiv="refresh" content="0;URL=http://www.test.com" /><% } %>
<% if (Request.QueryString("id") == 'example') { %><meta http-equiv="refresh" content="0;URL=http://www.theexamplesite.com" /><% } %>

Hope you can help me!

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T23:18:17+00:00Added an answer on May 18, 2026 at 11:18 pm
    <?php
    
    $targets = array(
      'test'    => 'http://www.test.com/',
      'example' => 'http://www.theexamplesite.com/',
    );
    
    if (isset($_GET['id']) && isset($targets[$_GET['id']]))
    {
      header('Location: '.$targets[$_GET['id']]);
      exit;
    }
    

    That way you have a good view of your configured redirects and are able to add / remove / update them easily !

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am not familiar with PHP at all and had a quick question. I
I'm planning to add XML support to application, but I'm not familiar with XML
I am not really familiar with Maven program but I've been using Eclipse for
I am not familiar with this website but I am desperately seeking help with
I am not familiar with this, and can use a kick start. I am
I believe there is a way to do this, but I'm not familiar with
I'm not overly familiar with Tomcat, but my team has inherited a complex project
I am not as familiar with Oracle as I would like to be. I
I'm not too familiar with generics (concept or the syntax) in general (short of
I am not that familiar with Javascript, and am looking for the function that

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.