Mike
Mike

Reputation: 3418

Difference between these three URL's?

Can somebody explain how does it matter to pass different parameters in a url,

e-g

1: www.domain.com/folder1/folder2/file.html?param=9?val=ty5?test
2: www.domain.com/folder1/folder2/file.html#param=93#val=t5y5?test=9
3: www.domain.com/folder1/folder2/file.html&param=9?val=ty5&test=90#poiu

Basically I want to know what do these three characters (#, &, ?) do in the url. I have seen them most of the times? can I use some thing other than that e-g: www.domain.com/folder1/folder2/file.html*param=9_val+ty5@test

Upvotes: 2

Views: 2559

Answers (4)

user1457024
user1457024

Reputation: 1

  • 1: ? is used for separating back end code to its arguments. Notice the file extension is html doesn't necessarily says that the back end code is in HTML
  • 2: # is used to link to anchors within the html page
  • 3: & is used for separating arguments with other arguments. in this case, the file.html is also an argument itself, while the backend code is the "/", which can be anything. e.g. index.php, default.asp, index.do. it all depends on your URL rewrite.

Upvotes: -1

Paul Fleming
Paul Fleming

Reputation: 24526

? indicates the start of the query string
& separates key value pairs of the querystring
# indicates an anchor. Here's more on anchor links.

Note that all three of your urls are incorrect.

Valid url:

http://domain/path/file?name=value&name=value#anc

I notice you've edited your question with an additional question

can I use some thing other than that e-g: www.domain.com/folder1/folder2/file.html*param=9_val+ty5@test

You can use whatever you like in the part of the querystring or anchor as long as it is url encoded.

Upvotes: 11

David Genn
David Genn

Reputation: 709

This Wikipedia article goes in to the detail and gives some good examples.

  • A ? indicates the start of the query
  • A & separates the parameters in the query
  • A # identifies a fragment in the HTML resource to be rendered. It's often used to identify which but if the page the browser should ensure is in view eg a heading etc

Upvotes: 3

Waqar Janjua
Waqar Janjua

Reputation: 6123

? represents that the URL contains QueryString values. & is used to for multiple querystring values. Example

www.abc.com/page?id=abc&pwd=def

and # is new for me I first time saw it.

Upvotes: 0

Related Questions