how to change default starting page to blog page?

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
7 years ago
in nopcommerce 3.7, how to change default starting page to blog page?
7 years ago
I want the blog page, be my home page.
7 years ago
You could try setting the DefaultDocument to point to yourwebsite/blog
7 years ago
excuse me, may you tell me how can I do it?
7 years ago
Hi there,

So, very briefly - by setting the default document you could redirect your website URL to a specified page.

Where exactly is this set?

Depends on where you have hosted your website on - so, if you've done it on azure there are plenty of articles explaining how to set the default document of your hosted website. If you're hosting provider is someone else, you could search their support forums on "How to set the default document of your hosted website"

To get a quick understanding of the workings of default document - please go through these articles:

https://support.microsoft.com/en-us/kb/320051

https://www.thesitewizard.com/apache/change-default-page-for-domain.shtml

The links I've provided may not be the best resources out there to understand defaultdocuments, but it will give you a head start.

So, Ideally, you'll be providing the blog page as the top default document.

Thanks,
Sagar
7 years ago
Dear SagarBhupalam

nopcommerce is based on MVC. so Default document not work here.
7 years ago
Please try URL Routing
7 years ago
Please try URL Routing
7 years ago
You can change the route in the global.asax.cs
Default route is
          
              routes.MapRoute(
                "Default", // Route name
                "{controller}/{action}/{id}", // URL with parameters
                new { controller = "Home", action = "Index", id = UrlParameter.Optional },
                new[] { "Nop.Web.Controllers" }
            );

This route will tell you execute in the HomeController, there is Index action (function) and return the view defined with the same name under the Views. View path will be Views/Home/Index
                
In order to change that you should add a welcome function (just copy the Index function and rename with welcome and paste it into the HomeController).
                
Then you can change your routing as bellow.
            
    routes.MapRoute(
                    "Default", // Route name
                    "{controller}/{action}/{id}", // URL with parameters
                    new { controller = "Home", action = "Blog", id = UrlParameter.Optional },
                    new[] { "Nop.Web.Controllers" }
                );
                                              
  
Dont forget to create your Blog view under Views/Home as Blog.cshtml

Thanks
7 years ago
Try like bellow==>


routes.MapRoute(
                    "Default", // Route name
                    "{controller}/{action}/{id}", // URL with parameters
                    new { controller = "Blog", action = "List", id = UrlParameter.Optional },
                    new[] { "Nop.Web.Controllers" }
                );
                    
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.