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

  • SEARCH
  • Home
  • 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 7547311
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T09:25:19+00:00 2026-05-30T09:25:19+00:00

I need to redirect some urls. Formerly I had http://mysite.com/foobar/?section_id=1234 These are no pointing

  • 0

I need to redirect some urls.

Formerly I had

http://mysite.com/foobar/?section_id=1234

These are no pointing to

http://mysite.com/foobar/1234

I put the following in my code to handle attempts to visit the old url:

$section_id = filter_input(INPUT_GET, 'section_id', FILTER_SANITIZE_NUMBER_INT);

if ( $section_id ) {
    header( "HTTP/1.1 301 Moved Permanently" );
    header( "Location: ".$_SERVER["SERVER_NAME"]."/foobar/".$section_id );
}

The problem is that after redirecting the url is:

http://mysite.com/foobar

The needed id is not there!

In that if statement if I do

echo "Location: ".$_SERVER["SERVER_NAME"]."/foobar/".$section_id;

I get:

http://mysite.com/foobar/1234

but then the redirect still fails to include the 1234 part.

Why is this and how to I get it to redirect as desired?


Output of lynx -head -dump http://mysite.com/foobar/1234 (i.e. it looks correct to me)

HTTP/1.1 301 Moved Permanently
Date: Mon, 20 Feb 2012 18:55:09 GMT
Server: Apache/2.2.3 (CentOS)
X-Powered-By: PHP/5.2.6
Set-Cookie: PHPSESSID=c35123456; path=/
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
X-Pingback: http://mysite.com/xmlrpc.php
Link: <http://wp.me/mysite>; rel=shortlink
Location: mysite.com/foobar/1234
Vary: Accept-Encoding
Connection: close
Content-Type: text/html; charset=UTF-8
  • 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-30T09:25:20+00:00Added an answer on May 30, 2026 at 9:25 am

    The Location header must have an absolute and valid URL as its value. I.e. must begin with http://.

    Edit: The Location header value can also be an absolute path starting with a forward slash /.

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

Sidebar

Related Questions

I need some help with a redirect: How do I take any URLs with
My site has some URLs that are rewritten by .htaccess... i.e. this: http://lastminuteislandvacation.com/villa/15/st-john-rental-villa-angelica is
I have web software where I need to have URLs like this http://site.com/page/var1/val1/var2//var3/val3 Then
I need to redirect some of the older pages in my application to new
I need to permanent redirect some pages, and redirect the user to the new
I need some advice on techniques to perform page redirect in asp.net. Which one
I need some help on mod rewrite 301 , to redirect my old website
I need to redirect any URLs without www. to URLs with www. for better
I need to match all urls that DO have mydomain.com in them AND DO
in my website I have some pages structured in this way: www.mysite.com/x/y.php?query=z I wrote

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.