473,382 Members | 1,445 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

Problem with REQUEST_URI

I hope I'm not doing something really stupid .... but I can't get this
to work properly.

I'm using $_SERVER['REQUEST_URI'] to get the name of the *referring*
page for use in a custom 404 page.

All works hunky-dory (with an .htaccess script and so on) ... but the
value always seems to return the *current* page (ie. the actual error
page that the user lands on) - not the "from" (referring) page.

OK ... so I tried a simple page with a regular URL link to another
page. The value of $_SERVER['REQUEST_URI'] on that 2nd page was also
the name of that 2nd page - yet $_SERVER['HTTP_REFERER'] gives the
required value.

What am I missing (apart from brain cells!)?

Is there a way of determining the referring page on non-Apache
servers?

Adam.
Jun 15 '06 #1
1 1508
See your phpinfo() result ...

Look at the PHP Variables..you'll find like :
_SERVER["HTTP_ACCEPT"]
_SERVER["HTTP_REFERER"]
and other variables. Check your refering variables for your server.

--
http://blog.deshot.com
http://www.padbuilder.com

Adam wrote:
I hope I'm not doing something really stupid .... but I can't get this
to work properly.

I'm using $_SERVER['REQUEST_URI'] to get the name of the *referring*
page for use in a custom 404 page.

All works hunky-dory (with an .htaccess script and so on) ... but the
value always seems to return the *current* page (ie. the actual error
page that the user lands on) - not the "from" (referring) page.

OK ... so I tried a simple page with a regular URL link to another
page. The value of $_SERVER['REQUEST_URI'] on that 2nd page was also
the name of that 2nd page - yet $_SERVER['HTTP_REFERER'] gives the
required value.

What am I missing (apart from brain cells!)?

Is there a way of determining the referring page on non-Apache
servers?

Adam.


Jun 15 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Kubaton Lover | last post by:
I'm still having a problem with the following code, but I can better describe the symptoms now. Code: <?php $uri = getenv('REQUEST_URI'); $pieces = explode('/',$uri); $file = $pieces;
2
by: jerrygarciuh | last post by:
Hello, I wanted to migrate some custom 404 error pages from shtml to php for the ease of email notification of lost pages. However when PHP processes the page $_ENV and $_SERVER both now hold...
10
by: Hywel | last post by:
this script don't work Script A: set session variable <?php class Page0A { function Page0A(){ $this->init(); $this->save();
12
by: Don | last post by:
What's the PHP equivalent for the following? if(window.location == "http:/site.com/page1.html") { } else { }
0
by: Simon | last post by:
Hi, When I have a page not found in Apache I can have it redirected to a custom ../error.php file and I can use $_SERVER to get the file that was not found. But as some of you might know, IIS...
5
by: Jeremy | last post by:
At some point, $_SERVER started including the query string. It seems to me that it didn't do this before. Example: for URL "http://www.foo.bar/path/script?thing=value" $_SERVER should be...
10
by: SoulIntruder | last post by:
Hello folks. I have a beginners question. I have such script: <?php $User = $_POST; $Password = $_POST; $Database = $_POST;
5
watagal
by: watagal | last post by:
Greetings I'm writing an error handling page for the common "404 Page Not Found" error using PHP. I need to retrieve the actual URL that was typed by the user. When I use $_SERVER - it...
0
by: gnawz | last post by:
I have a feedback form code which does email but does not display the correct content. In place of the email address, it displays "+1" And the body message is "1" It works well when I test...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.