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 anni tempo fa
in nopcommerce 3.7, how to change default starting page to blog page?
7 anni tempo fa
I want the blog page, be my home page.
7 anni tempo fa
You could try setting the DefaultDocument to point to yourwebsite/blog
7 anni tempo fa
excuse me, may you tell me how can I do it?
7 anni tempo fa
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 anni tempo fa
Dear SagarBhupalam

nopcommerce is based on MVC. so Default document not work here.
7 anni tempo fa
Please try URL Routing
7 anni tempo fa
Please try URL Routing
7 anni tempo fa
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 anni tempo fa
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.