<p>What is the configuration setting for modifying the default homepage in a Grails application to no longer be appName/index.gsp? Of course you can set that page to be a redirect but there must be a better way.</p>

[{'answer_id': 62067, 'author': 'dahernan', 'author_id': 6435, 'author_profile': 'https://Stackoverflow.com/users/6435', 'pm_score': 4, 'selected': False, 'text': '<p>Edit UrlMappings.groovy</p>\n\n<p>Add for example add this rule, to handle the root with a HomeController.</p>\n\n<p>"/"(controller:\'home\')</p>\n'}, {'answer_id': 62316, 'author': 'Bob Herrmann', 'author_id': 6580, 'author_profile': 'https://Stackoverflow.com/users/6580', 'pm_score': 6, 'selected': False, 'text': '<p>Add this in UrlMappings.groovy </p>\n\n<pre>\n "/" {\n    controller = "yourController"\n    action = "yourAction"\n }\n</pre>\n\n<p>By configuring the URLMappings this way, the home-page of the app will be yourWebApp/yourController/yourAction.</p>\n\n<p>(cut/pasted from <a href="http://blog.intelligrape.com/?p=18" rel="noreferrer">IntelliGrape Blog</a>)</p>\n'}, {'answer_id': 8580886, 'author': 'element40', 'author_id': 845579, 'author_profile': 'https://Stackoverflow.com/users/845579', 'pm_score': 2, 'selected': False, 'text': '<p>Simple and Neat</p>\n\n<ol>\n<li><p>Go to File: grails-app/conf/UrlMappings.groovy.</p></li>\n<li><p>Replace the line : "/"(view:"/index")  with \n"/"(controller:\'home\', action:"/index").</p></li>\n</ol>\n\n<p>Home is Your Controller to Run(Like in spring security you can use \'login\' ) and action is the grails view page associated with your controller(In Spring Security \'/auth\').</p>\n\n<p>Add redirection of pages as per your application needs.</p>\n'}, {'answer_id': 17335212, 'author': 'Rashedul.Rubel', 'author_id': 1632305, 'author_profile': 'https://Stackoverflow.com/users/1632305', 'pm_score': 4, 'selected': False, 'text': '<p>You may try as follows<br>\nin the UrlMappings.groovy class which is inside the configuration folder:</p>\n\n<pre><code>class UrlMappings {\n\n    static mappings = {\n\n        "/$controller/$action?/$id?"{\n            constraints {\n                // apply constraints here\n            }\n        }\n\n        //"/"(view:"/index")\n        "/" ( controller:\'Item\', action:\'index\' ) // Here i have changed the desired   action to show the desired page while running the application\n        "500"(view:\'/error\')\n    }\n}\n</code></pre>\n\n<p>hope this helps,<br>\nRubel</p>\n'}, {'answer_id': 26539671, 'author': 'Mehul Katpara', 'author_id': 4093220, 'author_profile': 'https://Stackoverflow.com/users/4093220', 'pm_score': 0, 'selected': False, 'text': '<p>All the answers are correct!\nBut let\'s imagine a scenario: </p>\n\n<p>I mapped path "/" with the controller: "Home" and action: "index", so when i access "/app-name/" the controller Home gets executed, but if i type the path "/app-name/home/index", it will still be executed! so there are 2 paths for one resources. it would work until some one finds out "home/index" path.</p>\n\n<p>another thing is if I have a form without any action attribute specified, so by default it will be POST to the same controller and action! so if the form is mapped to "/" path and no action attribute is specified then it will be submitted to the same controller, but this time the path will be "home/index" in your address-bar, not "/", because it\'s being submitted to the controller/action not to the URI.</p>\n\n<p>To solve this problem what you have to do, is to remove or comment out these lines.</p>\n\n<pre><code>//        "/$controller/$action?/$id?(.$format)?"{\n//            constraints {\n//                // apply constraints here\n//            }\n//        }\n</code></pre>\n\n<p>So now when you access "/", will work. but "home/index" will not. But there\'s a one flaw, now you have to map all the paths to the controllers manually by explicitly writing into URLMapping file. I guess this would help! </p>\n'}, {'answer_id': 28975869, 'author': 'Robert Erlinger', 'author_id': 1552745, 'author_profile': 'https://Stackoverflow.com/users/1552745', 'pm_score': 2, 'selected': False, 'text': '<p>Use controller, view and action parameter by the following syntax:</p>\n\n<pre><code>class UrlMappings {\n   static mappings = {\n       "/" (controller:\'dashboard\', view: \'index\', action: \'index\')\n       "500"(view:\'/error\')\n   }\n}\n</code></pre>\n'}, {'answer_id': 55970990, 'author': 'John Little', 'author_id': 1072187, 'author_profile': 'https://Stackoverflow.com/users/1072187', 'pm_score': 0, 'selected': False, 'text': '<p>If anyone is looking for the answer for gails 3.x, they moved UrlMappings.groovy to grails-app/controllers/appname</p>\n\n<p>As the below answers say, just ed it the line starting with "/".</p>\n\n<p>In my case its:</p>\n\n<pre><code>"/"(controller:"dashboard", view:"/index")\n</code></pre>\n'}]
['https://Stackoverflow.com/questions/27846', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/3014/']