$REQUEST_URI is empty with every URI

Discussion in 'HTML' started by Matthias Pospiech, Jan 5, 2005.

  1. I use a mod_rewrite system.
    The according index.php (where modrewrite directs to) is loaded.

    But nomatter what the URL looks like $REQUEST_URI is always empty
    so for example for http://www.local-matthias.de/links/123/456/
    I would expect $REQUEST_URI = links/123/456/
    but its empty...

    any idea what to check, or which configuration (apache) might be
    interesting ?

    Matthias
     
    Matthias Pospiech, Jan 5, 2005
    #1
    1. Advertising

  2. Matthias Pospiech

    Toby Inkster Guest

    Matthias Pospiech wrote:

    > I use a mod_rewrite system.
    > The according index.php (where modrewrite directs to) is loaded.

    [...]
    > so for example for http://www.local-matthias.de/links/123/456/
    > I would expect $REQUEST_URI = links/123/456/


    You seem to be doing a rewrite like this:

    /links/123/456 -> /index.php

    Don't do that. Do this:

    /links/123/456 -> /index.php?uri=/links/123/456

    Then read $_GET['uri'] in your PHP.

    --
    Toby A Inkster BSc (Hons) ARCS
    Contact Me ~ http://tobyinkster.co.uk/contact
     
    Toby Inkster, Jan 5, 2005
    #2
    1. Advertising

  3. Toby Inkster wrote:

    > Matthias Pospiech wrote:
    >
    >> I use a mod_rewrite system.
    >> The according index.php (where modrewrite directs to) is loaded.

    > [...]
    >> so for example for http://www.local-matthias.de/links/123/456/
    >> I would expect $REQUEST_URI = links/123/456/

    >
    > You seem to be doing a rewrite like this:
    >
    > /links/123/456 -> /index.php
    >
    > Don't do that. Do this:
    >
    > /links/123/456 -> /index.php?uri=/links/123/456
    >
    > Then read $_GET['uri'] in your PHP.
    >

    Why ?
    It works on other servers (like www.matthiaspospiech.de)
    It worked before on my home computer, but now it doesn't

    How would I have to write the mod_rewrite rule, to do that ?

    Currently its
    RewriteRule !\.(gif|jpg|png|css|php|pdf|zip)$ index.php

    and index.php set variables, and includes inc_index.php
    which is the actual index.php of the website.

    Matthias
     
    Matthias Pospiech, Jan 6, 2005
    #3
  4. Matthias Pospiech

    Toby Inkster Guest

    Matthias Pospiech wrote:

    > How would I have to write the mod_rewrite rule, to do that ?
    >
    > Currently its
    > RewriteRule !\.(gif|jpg|png|css|php|pdf|zip)$ index.php


    Untested...

    RewriteCond %{REQUEST_FILENAME} !\.(gif|jpg|png|css|php|pdf|zip)$
    RewriteRule ^(.*)$ index.php?url=$1

    --
    Toby A Inkster BSc (Hons) ARCS
    Contact Me ~ http://tobyinkster.co.uk/contact
     
    Toby Inkster, Jan 7, 2005
    #4
    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. Simon Harris
    Replies:
    0
    Views:
    6,382
    Simon Harris
    May 10, 2005
  2. Stanimir Stamenkov
    Replies:
    1
    Views:
    2,476
    Stanimir Stamenkov
    Aug 17, 2005
  3. Pavel
    Replies:
    2
    Views:
    1,651
    Peter Flynn
    Aug 4, 2004
  4. etheriau
    Replies:
    1
    Views:
    669
    Pavel
    Aug 23, 2004
  5. Joe Curry

    Invalid URI: The format of the URI could not be determined.

    Joe Curry, Oct 8, 2003, in forum: ASP .Net Web Services
    Replies:
    0
    Views:
    344
    Joe Curry
    Oct 8, 2003
Loading...

Share This Page