By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,965 Members | 1,702 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,965 IT Pros & Developers. It's quick & easy.

Obtaining the URL

P: n/a
$_SERVER["SERVER_NAME"] and $_SERVER["HTTP_HOST"] are good and all, but none
of them are reliable.

Eg: Not all subdomains will have a vhost entry for them in Apache, or the
Host: header is not filled in.

So are there any other methods of determining the URL of the script itself?

Alex
Jul 17 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a

"Alex" <al*******@hotmail.com> wrote in message
news:35********************@news20.bellglobal.com. ..
$_SERVER["SERVER_NAME"] and $_SERVER["HTTP_HOST"] are good and all, but none of them are reliable.

Eg: Not all subdomains will have a vhost entry for them in Apache, or the
Host: header is not filled in.

So are there any other methods of determining the URL of the script itself?
Alex


The answer is no, as the URL itself is not passed in the request.
Jul 17 '05 #2

P: n/a
Chung Leong wrote:
"Alex" <al*******@hotmail.com> wrote in message
news:35********************@news20.bellglobal.com. ..
$_SERVER["SERVER_NAME"] and $_SERVER["HTTP_HOST"] are good and all, but


none
of them are reliable.

Eg: Not all subdomains will have a vhost entry for them in Apache, or the
Host: header is not filled in.

So are there any other methods of determining the URL of the script


itself?
Alex

The answer is no, as the URL itself is not passed in the request.


Chung: the answer is yes... hint: use phpinfo() to find it... then
search the docs to see how to code it...

Both the source and the target are specified.

Michael Austin.
Jul 17 '05 #3

P: n/a

"Michael Austin" <ma*****@firstdbasource.com> wrote in message
news:VT******************@newssvr24.news.prodigy.c om...
Chung Leong wrote:
"Alex" <al*******@hotmail.com> wrote in message
news:35********************@news20.bellglobal.com. ..
$_SERVER["SERVER_NAME"] and $_SERVER["HTTP_HOST"] are good and all, but


none
of them are reliable.

Eg: Not all subdomains will have a vhost entry for them in Apache, or theHost: header is not filled in.

So are there any other methods of determining the URL of the script


itself?
Alex

The answer is no, as the URL itself is not passed in the request.


Chung: the answer is yes... hint: use phpinfo() to find it... then
search the docs to see how to code it...

Both the source and the target are specified.

Michael Austin.


Read the OP carefully, pal. He was referring to a HTTP 1.0 scenario, where
the host name is not included in the request. In that case when two DNS
names are mapped to the same IP address, there's no way for the server to
tell which of the two was actually typed in.

Name-based virtual hosting requires HTTP 1.1--that's a well known fact.
Jul 17 '05 #4

P: n/a
Chung Leong wrote:
"Michael Austin" <ma*****@firstdbasource.com> wrote in message
news:VT******************@newssvr24.news.prodigy.c om...
Chung Leong wrote:

"Alex" <al*******@hotmail.com> wrote in message
news:35********************@news20.bellglobal.c om...
$_SERVER["SERVER_NAME"] and $_SERVER["HTTP_HOST"] are good and all, but

none
of them are reliable.

Eg: Not all subdomains will have a vhost entry for them in Apache, or
the
Host: header is not filled in.

So are there any other methods of determining the URL of the script

itself?
Alex

The answer is no, as the URL itself is not passed in the request.


Chung: the answer is yes... hint: use phpinfo() to find it... then
search the docs to see how to code it...

Both the source and the target are specified.

Michael Austin.

Read the OP carefully, pal. He was referring to a HTTP 1.0 scenario, where
the host name is not included in the request. In that case when two DNS
names are mapped to the same IP address, there's no way for the server to
tell which of the two was actually typed in.

Name-based virtual hosting requires HTTP 1.1--that's a well known fact.


My apologies Chung, but, I did not see anywhere in the OP where he
mentions he was using HTTP 1.0. It is possible that he is, it is just
not stated. HTTP_REFERER is in both RFC's for HTTP. I don't have a
HTTP/1.0 server to test to see what server name is in the URL using
vhosts... I have used this reliably for a long time now...

So, Alex, did any of this solve your problem?

if not, then you can always define a <input type=hidden...> to define
the full path, however, you will need to be aware that anyone looking at
the source will be able to see it...

Michael Austin.
Jul 17 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.