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 6947635
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T13:43:06+00:00 2026-05-27T13:43:06+00:00

This one should be easy… Do I need to explicitly tell PHP that I

  • 0

This one should be easy…

Do I need to explicitly tell PHP that I want to do a 301 redirect? Like this…

<?php
header("HTTP/1.1 301 Moved Permanently");
header("Location: http://www.example.com/");
?>

Usually, I leave off the first statement and just do…

<?php
header("Location: http://www.example.com/");
?>

Would that second example actually be a 302 redirect?

  • 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-27T13:43:07+00:00Added an answer on May 27, 2026 at 1:43 pm

    Yes.

    To quote the fine manual:

    The second special case is the “Location:” header. Not only does it send this header back to the browser, but it also returns a REDIRECT (302) status code to the browser unless the 201 or a 3xx status code has already been set.

    The most likely reason for this is that a 302 Found is a nonspecified-purpose redirect. There are four 3xx redirect headers that you can use.

    • 301 Moved Permanently is a permanent redirect, e.g. for keeping compatibility with old URLs. As such, many browsers will cache the redirect location, and won’t check again.
    • 303 See Other is the redirect intended e.g. for a Post-Redirect-Get action – note that it’s only defined as of HTTP/1.1
    • 307 Temporary Redirect means “yeah, it’s usually here, but right now, the resource is somewhere else” – that may not be the meaning you want: e.g. you always want to redirect at this point. Again, defined in HTTP/1.1
    • Finally, 302 Found is a unspecified-purpose redirect – to be used when the above aren’t applicable, or when HTTP/1.0 compatibility is desired (is that still a concern in 2011?); as such, it is used as the default.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This should be an easy one. I have a table like so: <table> <tr>
Possible Duplicate: Property Name and need its value Hi, This one should be easy
I want to create a progress tracker like this one: https://hmv.com/hmvweb/checkoutRegister.do but I need
This should be easy (at least no one else seems to be having a
This should be and easy one for the LINQ gurus out there. I'm doing
Good afternoon, This should be an easy one. I've done the cookie-cutter default ASP.NET
In this thread some one commented that the following code should only be used
Has any one done this before? It would seem to me that there should
This one should be easy, and I think I know the right answer, but
This one should be easy, I think. I have a paginated image gallery, and

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.