?
Solved

mod_rewrite and incorrect $_SERVER['REQUEST_URI']

Posted on 2005-03-11
8
Medium Priority
?
327 Views
Last Modified: 2008-03-06
I've made my site search engine friendly using URLs like

/genere/date/id/

which in mode_rewrite will be
file.php?genre=var&date=var&id=var



but...I was assuming when I echo $_SERVER['REQUEST_URI'] it will be

      /genere/date/id/

but instead it is

     file.php?genre=var&date=var&id=var


I was wondering if anyone has had to deal with this before, if its a config problem or is there a hack to allow me to echo the correct URI for use in links etc...
Thanks!




Regards,
Nick
0
Comment
Question by:CrYpTiC_MauleR
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
8 Comments
 
LVL 25

Expert Comment

by:Marcus Bointon
ID: 13518316
Not that I'm aware of. The rewriting happens before PHP gets its hands on the request, so it doesn't know what was originally requested. You will have the recreate links based on the fact that you know what they are supposed to be.
0
 
LVL 18

Author Comment

by:CrYpTiC_MauleR
ID: 13518457
Thats what I thought...

      RewriteRule ^support/([0-9]*)/$ /support.php?var=$1

ok seeing something like that...would it not be possible to do something like this?

      RewriteRule ^(support/([0-9]*))/$ /support.php?REQUEST_URI=$1&var=$2

so then the request will be sent as a variable so $_GET['REQUEST_URI'] will have the original request?

This is all assumption right now havent tested it.
0
 
LVL 18

Author Comment

by:CrYpTiC_MauleR
ID: 13518508
ok just tested, works great!!! =oD
0
WordPress Tutorial 2: Terminology

An important part of learning any new piece of software is understanding the terminology it uses. Thankfully WordPress uses fairly simple names for everything that make it easy to start using the software.

 
LVL 18

Author Comment

by:CrYpTiC_MauleR
ID: 13528523
if anyone is interested...

     RewriteRule ^support/([0-9]*)/$ /support.php?REQUEST_URI=%{REQUEST_URI}&var=$1

much better =oP, totoally forgot about the preset variables I could use.
0
 
LVL 18

Author Comment

by:CrYpTiC_MauleR
ID: 13899274
ack someone needs to close this O.O
0
 
LVL 18

Author Comment

by:CrYpTiC_MauleR
ID: 14615398
updated status? You mean status of the problem in question? Because the 4th post in this entry shows the solution...


>> if anyone is interested...
>>
>>     RewriteRule ^support/([0-9]*)/$ /support.php?REQUEST_URI=%{REQUEST_URI}&var=$1
>>
>> much better =oP, totoally forgot about the preset variables I could use.
0
 
LVL 2

Accepted Solution

by:
Lunchy earned 0 total points
ID: 14648203
Closed, 200 points refunded.
Lunchy
Friendly Neighbourhood Community Support Admin
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
The viewer will learn how to dynamically set the form action using jQuery.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
Suggested Courses

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question