Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6561007
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T13:32:03+00:00 2026-05-25T13:32:03+00:00

Currently everything under homecontroller appears in the URL as example.com/Home/{Action} Is there a way

  • 0

Currently everything under homecontroller appears in the URL as

example.com/Home/{Action}

Is there a way we can keep all other routing the way it is but ONLY special case home controller so everything under home comes under the domain.

like

example.com/about
example.com/contact
example.com/error

instead of creating new controller classes for each of them.

EDIT:

The other URL’s like

example.com/user/details/123
example.com/user/edit/123

Which are in the userController should work the same as they are now

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T13:32:04+00:00Added an answer on May 25, 2026 at 1:32 pm

    I think the best way is:

     routes.MapRoute("home", "home", new { controller = "Home", action = "Index" });
     routes.MapRoute("about", "about", new { controller = "Home", action = "About" });
     routes.MapRoute("contact", "contact", new { controller = "Home", action = "Contact" });
    
     routes.MapRoute(
         "Default", // Route name
         "{controller}/{action}/{id}", // URL with parameters
         new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults
     );
    

    and when you want to create a link, use:

    @Html.RouteLink("Home", "home", new{/* route values */}, new {/* html attribues */})
    

    OR:

    @Html.RouteLink("Home", "home")
    

    instead of:

    @Html.ActionLink("Home", "Index", "Home", new{/* route values */}, new {/* html attribues */})
    

    this works for me, and should work for you too.

    UPDATE:

    you can create a symbol like @ (or - or anything else), before the action part in url, to make the url unique, such as:

    routes.MapRoute(
        "test",  // route name
        "@{action}", // url and parameters
        new {controller = "MyHome", action = "Home"} // parameter defaults
        );
    routes.MapRoute(
        "Default", // Route name
        "{controller}/{action}/{id}", // URL with parameters
        new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults
         );
    

    in this way, your urls are different from the Default map-route and you can create urls like:

    site.com/@Home
    site.com/@About
    site.com/@Contact
    

    but the first, in my idea, is better and I always use that.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am currently trying to use this gem http://github.com/pengwynn/linkedin . Everything works fine (i.e.
I currently have a thread that I created using CreateRemoteThread(). Everything works great. Upon
I'm currently running into some issues resizing images using GD. Everything works fine until
I'm currently writing a Windows Explorer Shell Extension. Everything is ok so far but
How can I change the current working directory from within a Java program? Everything
I'm an app where everything is tied to the currently connected user. So far
I am currently implementing something similar to an hospital intra site, where doctors can
I'm having trouble forking a long-running process from some code running under mod_perl2. Everything
I am currently using wp_nav_menu to generate my nav menu. Although everything is working
I have a website say www.livesite.com which is currently running. I have been developing

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.