-6

What kind of HTML link is this? And how does it work?

I've researched in PHP, and it similar code, but href does not include file extension.

<a href="/directory/subdirectory/category?catID=2"> Link </a>

PM 77-1
  • 12,933
  • 21
  • 68
  • 111
JDeLeon
  • 9
  • 4
  • 2
    You maybe need to check this before posting question: https://stackoverflow.com/questions/4855168/what-is-href-and-why-is-it-used – Loki Sep 20 '19 at 20:49
  • https://launchschool.com/books/http/read/what_is_a_url – PM 77-1 Sep 20 '19 at 20:54
  • There is no extenstion because they are rewriting URLs: https://stackoverflow.com/questions/4026021/remove-php-extension-with-htaccess – Abu Nooh Sep 20 '19 at 20:56

5 Answers5

0

the domain will be the prefix for this link, after that it will be like it:

 www.example.com/directory/subdirectory/category?catID=2

and ?catID=2 is QueryString that transfer data in url.

  • This does not answer the OP's question about why there is no file extension at the end of the URL. – Skylar Sep 20 '19 at 21:04
0

The

?catID=2 

at the end means ur passing information to the url.

?

means that ur going to pass on info.

catID=2

is saying that ur going to pass on catID with a value of 2.

so

<a href="/directory/subdirectory/category?catID=2"> Link </a>

means ur passing on catID with a value of 2 to link:

directory/subdirectory/category
code lover
  • 151
  • 1
  • 2
  • 9
  • This does not answer the OP's question about why there is no file extension at the end of the URL. – Skylar Sep 20 '19 at 21:16
0

That URL sends you to the index (main) page of the /directory/subdirectory/category directory on the root of whatever website the link is on.

For example, on example.com, that link would send you to http://example.com/directory/subdirectory/category/index.html?catID=2. However, the /index.html will not show in the URL bar. The ?catID=2 is a query string. There is no extension because the server will automatically send the index.html file in the specified directory if there is no specific file requested. (Note: index.html is the default. Back-end scripts can change what file gets sent.)

Skylar
  • 928
  • 5
  • 18
0

Yes, links can be that way. It is a query to the directory on the site you're checking out.

www.example.com/directory/subdirectory/category?catID=2 Can become

<a href="/directory/subdirectory/category?catID=2"> Link </a>

on example.com

Michael Dodd
  • 10,102
  • 12
  • 51
  • 64
-1

This type of link shows that you are entering a particular directory in the root of the website. Let say you saw this link from a website called me.com then it means you have

me.com/directory/subdirectory/category?catID=2

However /directory/subdirectory/category?catID=2 is a query to the directory on that website.