? URL

S

SpaceGirl

tony said:
In the following URL the New York Times uses a "?" after the .html file
name.

I always thought that that was a query to a server - however in some of the
articles on their page some have the straight .html extension while others
have the one featured below:

http://www.nytimes.com/2004/09/01/politics/campaign/01campaign.html?hp

If any experts can offer explanations I would appreciate it.
Thank you.
TR


It's still likely to be server side. Server side scripts can have any
extension you like, so long as you have setup your server to handle them
that way. For example, our Apache server here uses both HTM and JSP
extensions depending where in the site you are, but both file types are
actually server-side scripts (jsp, or servlets). The same goes for ASP -
you could have the ASP engine (IIS) parse .HTM files if you wanted.

You can also use javascript to read the data in the address bar (known
as a query string) - so you could have a client side form post to a page
(mypage.htm?blah=abc) and use JS on mypage.htm to read the querystring
and do something with it... not recommended as it'd fail with JS turned
off...

--


x theSpaceGirl (miranda)

# lead designer @ http://www.dhnewmedia.com #
# remove NO SPAM to email, or use form on website #
 
T

tony ritter

SpaceGirl wrote in message:
It's still likely to be server side. Server side scripts can have any
extension you like, so long as you have setup your server to handle them
that way. For example, our Apache server here uses both HTM and JSP
extensions depending where in the site you are, but both file types are
actually server-side scripts (jsp, or servlets). The same goes for ASP -
you could have the ASP engine (IIS) parse .HTM files if you wanted.

You can also use javascript to read the data in the address bar (known
as a query string) - so you could have a client side form post to a page
(mypage.htm?blah=abc) and use JS on mypage.htm to read the querystring
and do something with it... not recommended as it'd fail with JS turned
off...
............
Thank you for the explanation but I was wondering why they used regular
..html URL extensions for many of their articles on their site - however
_other_ articles on their main page have a "?" after the .html as in the
URL described in the first thread.

Please advise if you get a chance.
Thanks for your time.
TR
 
J

Jeffrey Silverman

Thank you for the explanation but I was wondering why they used regular
.html URL extensions for many of their articles on their site - however
_other_ articles on their main page have a "?" after the .html as in the
URL described in the first thread.

Please advise if you get a chance.
Thanks for your time.
TR

It could be any one of a number of reasons. But pretty much everything
after the question mark is CGI stuff being sent to the server.

Keep in mind that the URL you see in your browser need not have *anything*
to do with the "real" path to the server-side files or applications, or
the "real" URL that is being served. Is is possible to have extremely
complicated URL rewriting to create virtual directories, virtual
applications, virtual servers, etc.

For example, my "main" web server uses Apache's mod_rewrite for ALL of
its URLs. There is no way for *you* to tell, though.

example:
http://engineering.jhu.edu/page1
actually gets rewritten to
http://engineering.jhu.edu/index_master.php/page1

But it used to get rewritten to:
http://engineering.jhu.edu/index2.html?select=page1

All the average surfer will ever see is the first URL, though.

For more info on mod_rewite, browse this:
http://httpd.apache.org/docs/mod/mod_rewrite.html

I don't know how IIS or iPlanet or other Web Servers do their rewriting,
but I am quite certain there are similar URL rewriting plug-ins for
other Web Servers thatn Apache.

there you go, more info than you need! later...
 
T

tony ritter

Jeffrey Silverman said:
It could be any one of a number of reasons. But pretty much everything
after the question mark is CGI stuff being sent to the server. [balance
snipped]
...........

Thank you Jeffrey.

However, in the following URL, it would seems that whatever server side
language is being used there is a key - or name - value pair being used
like:

http://engineering.jhu.edu/?select=page1

select // the variable name within the server side script being parsed
page1 // the value

whereas in the New York Times example there was no name value pair after the
? just:

?hp

as in:

http://www.nytimes.com/2004/09/01/politics/campaign/01campaign.html?hp

Please advise if you get a chance.
Thank you.
TR
 
A

Andrew Urquhart

*tony ritter* wrote in alt.html:
[Query on URIs without querystring keys, only values]

If the programmer of that area of the site has decided that there will
only ever be one querystring key required, then that key can be
redundant in the URI and omitted if the programmer wishes it to be. A
plain ASP JScript example of how it could be used might be:

var strAdCampaign = Request.QueryString.Count ?
trim(Request.QueryString.Item) : "";

switch (strAdCampaign.toUpperCase()) {
case "HP" : GetCampaign("HP"); break;
case "DELL" : GetCampaign("DELL"); break;
case "INTEL" : GetCampaign("INTEL"); break;
default : GetCampaign_Default();
}

However, as previously mentioned the URI could be completely virtual
with no physical files or directories behind it. An example here might
be that all directories, files and querystring data after the domain
part of the URI are simply parameters for one server-side script, and
could be re-written on the fly from:

/2004/09/01/politics/campaign/01campaign.html?hp
to:
main.php?y=2004&m=09&d=01&sect=politics&subsect=campaign&page=01campaign&advert=hp

If you really want to know the programmers intentions you'd have to ask
them directly!
 
C

Chris Morris

tony ritter said:
However, in the following URL, it would seems that whatever server side
language is being used there is a key - or name - value pair being used
like:

http://engineering.jhu.edu/?select=page1

whereas in the New York Times example there was no name value pair after the
? just:

http://www.nytimes.com/2004/09/01/politics/campaign/01campaign.html?hp

Lots of server-side scripts treat the query string (everything after
the ? [1]) as a set of name/value pairs. However, it's quite
acceptable to treat it as a string.

So those two URLs could be treated as having query strings of
"select=page1" and "hp" respectively.

[1] Simplification: If there's a # after the ?, everything between the
? and the #
 
J

Jeffrey Silverman

If you really want to know the programmers intentions you'd have to ask
them directly!

Right. The point, Mister OP (tony ritter), is that there is really no way
to tell what is going on behind the scenes.

All data that is after the question mark arrives at the server in the
server environment variable QUERY_STRING. (this is an oversimplification).

The programmer can do whatever she wants with the string.

Why don't you write the NY Times webmaster and see if they will tell you
what is going on? They probably won't, but they might. *I* would, if
someone wrote me (and I have received similar emails in the past).
 

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
474,431
Messages
2,571,679
Members
48,796
Latest member
Greg L.

Latest Threads

Top