htaccess redirect and http response codes

Discussion in 'HTML' started by Karl Core, Dec 17, 2004.

  1. Karl Core

    Karl Core Guest

    OK, related to yesterday's conversation, during which it was mentioned that
    php's header(location: ) automatically sends the HTTP 301 response code, it
    got me thinking - does this also happen automatically with a redirect from
    ..htaccess?

    TIA


    --
    -Karl Core
    Please Support "Project Boneyard":
    http://www.insurgence.net/info.aspx?action=band&item=boneyard
     
    Karl Core, Dec 17, 2004
    #1
    1. Advertising

  2. Karl Core

    GreyWyvern Guest

    On Fri, 17 Dec 2004 11:50:00 -0500, Karl Core <>
    wrote:

    > OK, related to yesterday's conversation, during which it was mentioned
    > that
    > php's header(location: ) automatically sends the HTTP 301 response code,
    > it
    > got me thinking - does this also happen automatically with a redirect
    > from
    > .htaccess?


    Yesh.

    <http://httpd.apache.org/docs-2.0/mod/mod_alias.html.en#redirect>

    Grey

    --
    The technical axiom that nothing is impossible sinisterly implies the
    pitfall corollory that nothing is ridiculous.
    - http://www.greywyvern.com - Orca Knowledgebase: Completely CSS styleable
    Knowledgebase/FAQ system
     
    GreyWyvern, Dec 17, 2004
    #2
    1. Advertising

  3. Karl Core

    Karl Core Guest

    "GreyWyvern" <> wrote in message
    news:eek:...
    > On Fri, 17 Dec 2004 11:50:00 -0500, Karl Core <>
    > wrote:
    >
    >> OK, related to yesterday's conversation, during which it was mentioned
    >> that
    >> php's header(location: ) automatically sends the HTTP 301 response code,
    >> it
    >> got me thinking - does this also happen automatically with a redirect
    >> from
    >> .htaccess?

    >
    > Yesh.
    >
    > <http://httpd.apache.org/docs-2.0/mod/mod_alias.html.en#redirect>
    >


    Thanks!


    --
    -Karl Core
    Please Support "Project Boneyard":
    http://www.insurgence.net/info.aspx?action=band&item=boneyard
     
    Karl Core, Dec 17, 2004
    #3
  4. Charles Sweeney, Dec 17, 2004
    #4
  5. Karl Core

    GreyWyvern Guest

    On 17 Dec 2004 17:47:49 GMT, Charles Sweeney <> wrote:

    > GreyWyvern wrote:
    >
    >> Yesh.

    >
    > You sound just like Sean Connery!


    Some people say I look like him too ;) I think he stole all my moves.

    Grey
     
    GreyWyvern, Dec 17, 2004
    #5
  6. GreyWyvern <> wrote:

    >> that php's header(location: ) automatically sends the HTTP 301
    >> response code, it got me thinking - does this also happen
    >> automatically with a redirect from .htaccess?

    >
    > Yesh.
    >
    > <http://httpd.apache.org/docs-2.0/mod/mod_alias.html.en#redirect>


    Nope. As the cited document says,
    "If no status argument is given, the redirect will be "temporary" (HTTP
    status 302)." Thus, a simple

    redirect /~jkorpela/foo http://www.cs.tut.fi/~jkorpela/bar

    will send the 302 response code (which means that clients should keep
    using the original address, instead of updating their hotlists,
    databases, or whatever).

    But you can make the server send a permanent redirect, i.e. response
    code 301, in several ways:

    redirect 301 /~jkorpela/foo http://www.cs.tut.fi/~jkorpela/bar
    redirect permanent /~jkorpela/foo http://www.cs.tut.fi/~jkorpela/bar
    RedirectPermanent /~jkorpela/foo http://www.cs.tut.fi/~jkorpela/bar

    I have no idea why Apache chose the default of sending a temporary
    redirect.

    --
    Yucca, http://www.cs.tut.fi/~jkorpela/
    Pages about Web authoring: http://www.cs.tut.fi/~jkorpela/www.html
     
    Jukka K. Korpela, Dec 19, 2004
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. David Dorward
    Replies:
    2
    Views:
    1,717
    Art Sackett
    Jun 29, 2003
  2. Replies:
    2
    Views:
    2,896
    Malcolm
    Aug 20, 2005
  3. Allen
    Replies:
    1
    Views:
    667
    Mark Rae [MVP]
    Dec 3, 2007
  4. Sal
    Replies:
    1
    Views:
    814
  5. David Morgan
    Replies:
    1
    Views:
    335
    raj chahal
    Feb 24, 2006
Loading...

Share This Page