简体   繁体   中英

Redirect URL with C# MVC 4

I have a blog that currently uses Joomla. But as I need to make some settings becoming a mini blog with a mini system, I'm porting the Joomla MVC 4 for a C # application.

My problem is that the old URLs are in default:

http://www.sesmt.com.br/portal/index.php?option=com_content&view=article&id=1494:dds1494&catid=60:art-dds&Itemid=78

How do I get the id and send this URL for a URL type "http :/ / site.com / Blog / Article / id"

And when the idea is MVC 4 application, receive http://www.sesmt.com.br/portal/index.php?option=com_content&view=article&id=1494:dds1494&catid=60:art-dds&Itemid=78 he goes to http: // site.com/Blog/Article/id. the id is the original URL.

First step is to create MVC Routes if you want to shape the url.

routes.MapRoute(
                name: "BlogRoute",
                url: "Blog/Index/{view}/{id}",
                defaults: new
                    {
                        controller = "Blog",
                        action = "Index",
                        view = "Article",
                        id = UrlParameter.Optional
                    }
                );

What you are saying about MVC 4 recieving your PHP URL doesn't make any sense to me. If you want to do some automagic redirection that has to be done in IIS.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM