In my application, the http://localhost:8080/TestApplication/subCategories/2
will display subcategories of my table with id 2.
<a href="hello">Click Here</a>
When I click on the link rendered by the HTML above, my server is redirecting to http://localhost:8080/SecondOpinion/subCategories/hello
I want it to redirect to http://localhost:8080/SecondOpinion/hello
How do I achieve that?
First of all, this is nothing to do with "anchor tags". An anchor tag is an HTML element of the form <a name="here">
, and it defines a location within the HTML that another URL can link to .
What you have is an ordinary HTML link, and what you are seeing is standard HTML behavior for a relative link.
A relative link is resolved related to the "parent" URL for the page containing the link.
If you want a link to go somewhere else, you can:
<base href="...">
element into your document's <head>
section.In your case, you seem to be 1 combining relative URLs with some unspecified server-side redirection. In this case, you could either:
I can't tell which would be more appropriate.
1 - I am inferring this because you said "my server is redirecting to" . It is possible that you actually mean that the browser is sending that URL to the server, and there is no redirection happening at all.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.