SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Enthusiast
    Join Date
    Feb 2007
    0 Post(s)
    0 Thread(s)

    HTTP 300 Redirection

    I'm having some trouble with HTTP 300 redirection, particularly in how Opera chooses to handle it. I'm not sure if this is the right forum for this problem, but it seemed like the best choice; if not, please forgive my ignorance.

    My site is multilingual, and will need to be able to deliver linguistically appropriate content to users who haven't yet explicitly specified which language they prefer.

    For instance, a request for the (relative) URL "/pages/view/id/home" will need to be redirected (based on the language preferences provided by the browser) to something like "/pages/view/id/home/lang/en_US" or "/pages/view/id/home/lang/fr". (BTW, these are Zend Framework URLs; I may change them later to make them shorter.)

    As I understand it, this kind of redirection should be handled via an HTTP 300 status header. So...if the user requests "/pages/view/id/home" and his or her "Accept-Language" settings indicate that he or she likes U.S. English pages, we send the following response:

    (roughly, these are the headers...I realize they may not look exactly like this, but this should give the right idea.)
    Status: HTTP/1.1 300 Multiple Choices
    (and then this is the content)
    HTML Code:
    <h1>Please Choose a Language</h1>
    <li><a href="/pages/view/id/home/lang/en_US">U.S. English</a></li>
    <li><a href="/pages/view/id/home/lang/fr">French</a></li>
    <li><a href="/pages/view/id/home/lang/de">German</a></li>
    Now, that "Location" header is used to specify what is, in the server's opinion, the best possible choice. According to the spec, user agents "MAY" automatically redirect to this server-provided location, but just in case they don't, the response content should (as above) consist of a list of all the possible choices.

    Firefox and IE both implement automatic redirection in this situation; Opera, however, does not seem to do so. While this is technically allowable according to the spec, it's pretty inconvenient, especially if my pages (and more importantly, printed promotional materials) include a lot of language-agnostic links. Users will get pretty tired of seeing that language chooser.

    So, my question in a there something I can do differently with my HTTP headers to make sure that Opera DOES automatically redirect for HTTP 300s with Locations? Or am I stuck with the default?

    Or am I missing something obvious?

    Thanks for any help you can offer!

  2. #2
    Certified Ethical Hacker silver trophybronze trophy dklynn's Avatar
    Join Date
    Feb 2002
    20 Post(s)
    3 Thread(s)

    Check for mod_negotiation - that's supposed to do the job automatically (based on the request from the browser).


    David K. Lynn - Data Koncepts is a long-time WebHostingBuzz (US/UK)
    Client and (unpaid) WHB Ambassador
    mod_rewrite Tutorial Article (setup, config, test & write
    mod_rewrite regex w/sample code) and Code Generator


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts