$REQUEST_URI is empty with every URI

  • Thread starter Matthias Pospiech
  • Start date
M

Matthias Pospiech

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
 
T

Toby Inkster

Matthias said:
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.
 
M

Matthias Pospiech

Toby said:
Matthias said:
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
 
T

Toby Inkster

Matthias said:
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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top