2

I implement a website with ASP.net MVC. Everything works fine in offline. But the problem is that when I upload in my host, it adds the name of my root folder to the URL.

I want to upload my project in GoDaddy Plesk hosting. My GoDaddy host is the kind that I can have more than one domain setting on it. So I have four different web sites on it.

The other websites are just simple html websites and works fine and the URL is just the domain with nothing added more.

But this project is with ASP.net MVC. For example suppose my domain is www.example.com and I create a folder named example in the root for this project's root, then after uploading my project in the folder example as project root, then I added IIS management for my domain.

Now when I type www.example.com in the browser, it redirects to www.example.com/example/id and I do not want this to add the name of my root folder to my URL.

I am not sure if the problem is in my side or some settings in GoDaddy but here is my route config:

public class RouteConfig
{
    public static void RegisterRoutes(RouteCollection routes)
    {
        routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

        routes.MapRoute(
            name: "Default",
            url: "{action}/{id}",
            defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
        );
    }
}

enter image description here

I need my URL to be just www.example.com/id

Appreciate any help.

Jaydeep Karena
  • 159
  • 1
  • 5
  • 14
neda Derakhshesh
  • 1,103
  • 2
  • 20
  • 43
  • 1
    "I created a Folder named example in the root "...this implies that _you_ created the folder, not GoDaddy? Why not just upload your project directly into the root and not a subfolder? – ADyson May 23 '18 at 20:08
  • @ADyson because I have another web site in the root, I have four diffrent websites in my host for different projects. others works fine while others are not in asp.net MVC – neda Derakhshesh May 23 '18 at 20:18
  • @nedaDerakhshesh! At godaddy file system you have 4 folders at root level hosting 4 different websites? So what I can understand is that you have may have to update the content path of your MVC application using godaddy hosting panel to point to /example folder instead of root and I think you can do that using Plesk panel website settings. – Mohsin Mehmood May 23 '18 at 20:47
  • @MohsinMehmood thank you very much,if you mean In hosted domain part, I added this URL with choosing the example folder for the example.com URL. That's why it shows my website – neda Derakhshesh May 23 '18 at 20:57
  • Do you have a screenshot of the plesk website settings? Each of four websites have separate folder at the root level? – Mohsin Mehmood May 23 '18 at 21:00
  • So your mvc website is using a different domain from the website in the root, is that correct? E.g. the mvc website is `www.example.com` but the root website is `www.example2.com`, something like that? If so then I would expect you can do configure the domain mapping so that the root of `www.example.com` is set as the /example folder and not the main root folder. I don't know how to do it in plesk specifically but I would expect it to be possible. I think you need to find out how to do that, or ask godaddy's support – ADyson May 23 '18 at 21:03
  • 1
    Perhaps, for clarity, it would help us if you show your hosted folder structure and explain which domains are mapped to which folders currently, and any other relevant settings, and mark where your mvc site and others are located – ADyson May 23 '18 at 21:04
  • 1
    @ADyson I added an image to the question. may help to know the structure better . thank you very very much – neda Derakhshesh May 23 '18 at 21:21
  • 1
    it may help you https://www.c-sharpcorner.com/article/how-to-host-your-Asp-Net-mvc-website-on-godaddy-server/ – ArunPratap May 24 '18 at 12:37
  • 1
    @ArunPratap thank you very much. this article is a little old and Godaddy changed a little bit from these images. but I did everything exactly as the article before. there is nothing new. but thank you very very much. I am trying to change my question so May I delete this one . thank you again – neda Derakhshesh May 24 '18 at 12:40

0 Answers0