Redirect admin login page

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
6 年 前
Hi,

I would like to redirect /admin to page not found instead of going to login page if user is not logged in. I have tried adding authentication in Administration/web.config but to no success. Is there any way i can achieve this?

Regards,
Chee Fi
6 年 前
Hello Cheefi,


Create your own route for admin panel.

So It's not required more customize for your requirement.

Let me know if you need any help from my side.

Thanks.
6 年 前
Hi nopSquare,

Even if i route admin to another url, when type the new url /(admin route) it will still opens up the login page. What I want is to route user to 404 instead of the login page for admin if user type /(admin route). Is there any way to do this?
6 年 前
Hello Cheefi,

Can you please share your code?

So we can try to resolved your issues.

Thanks,
6 年 前
Hello Cheefi,

Please try below code.


public override void RegisterArea(AreaRegistrationContext context)
        {
            context.MapRoute(
                "Admin_default",
                "Admin1/{controller}/{action}/{id}",
                new { controller = "Home", action = "Index", area = "Admin", id = "" },
                new[] { "Nop.Admin.Controllers" }
            );
        }


Please try this code.

Let me know if your issue is resolved or not.

Thanks,
6 年 前
Hi,

This will change all my url to admin1/path. I still want to remain /admin. Its just that if user not logged in, when user type /admin, it will redirect to 404 not found page instead of /login. If user wants to login, they will login thru /login.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.