Abhilash Shajan
Abhilash Shajan

Reputation: 650

context path is not getting in URL

Iam using spring-security-core 3.1.1 in my grails 3.2.7 application. I have added the following code in my application.yml

server:
   contextPath: /LGP
   port: 9090

So the appcode LGP will be appended to my URL. eg: http://localhost:9090/LGP/home

But the problem is when i'm using the <a href="/projects">Projects</a> tag, the URL is becoming http://localhost:9090/home , the app code (LGP) getting skipped from the URL. Why this is happening? For the time being i update the tag as <a href="/${request.contextPath}/projects">Projects</a> but this gives the URL only as

lgp/projects

the http://localhost:9090/ section is getting missed.

Why this is like this?

Upvotes: 0

Views: 289

Answers (1)

Mike W
Mike W

Reputation: 3932

If you're linking to a controller use:

<g:link controller="projects">Projects</g:link>

If you're linking to e.g. a static resource use:

<g:link uri="/projects">Projects</g:link>

Upvotes: 1

Related Questions