Armand
Armand

Reputation: 24343

How to run Grails in a subdirectory?

Is it possible to configure Grails to run within a subdirectory? By default in development it runs in:

http://localhost:8080/appname/$controller/$action

I would like to configure it to run in:

http://localhost:8080/appname/subdirectory/$controller/$action

Upvotes: 0

Views: 260

Answers (2)

James Kleeh
James Kleeh

Reputation: 12228

In Config.groovy, you could add this to get the effect of it running in a subdirectory:

grails.app.context = '/subdirectory'

Upvotes: 3

Tom Metz
Tom Metz

Reputation: 919

If it is only about "subdirectory" in URL, just improve your URLMappings:

 "/subdirectory/$controller/$action?/$id?" {
            constraints {
                // apply constraints here
            }
    }

Upvotes: 1

Related Questions