如何配置asp.net core 2.2应用程序,以使wordpress加载到其自己的子文件夹中而不是root文件夹中? [英] How do I configure my asp.net core 2.2 app so that wordpress loads in its own subfolder instead of root?

查看:70
本文介绍了如何配置asp.net core 2.2应用程序,以使wordpress加载到其自己的子文件夹中而不是root文件夹中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 https://上使用asp.net core 2.2和最新的peachpie和wordpress回购github.com/iolevel/wpdotnet-sdk .我只想配置wordpress以加载到文件夹中,而不是root-即. https://my.examplesite.com/content

I'm using asp.net core 2.2 and the latest peachpie and wordpress repo at https://github.com/iolevel/wpdotnet-sdk. I just want to configure wordpress to load in a folder vs. root - ie. https://my.examplesite.com/content vs. https://my.examplesite.com

我觉得自己已经完成了艰巨的工作-我从peachpie的工作仓库中抓取了这些项目,并将它们合并到自己的解决方案中,并且如果我运行该应用程序,则可以使用wordpress作品.如果我将应用程序注释掉,我的应用程序将按预期工作.从startup.cs使用UseWordPress().唯一的问题是,我希望现有的应用程序可以在根目录下运行,而wordpress可以在子文件夹中运行-即. https://my.examplesite.com/content

I feel like I have the hard stuff done - I grabbed the projects from peachpie's working repo, incorporated them into my own solution and wordpress works if I run the app. My app works as expected if I comment out the app.UseWordPress() from startup.cs. The only problem is I'd like my existing app to run at root and wordpress to run in a subfolder - ie. https://my.examplesite.com/content vs. https://my.examplesite.com. Right now if I enable app.UseWordPress() then my app can't be reached.

理想情况下,用户必须先通过身份登录asp.net核心应用程序,才能获得上述wordpress内容.

Ideally users can't reach the abovee wordpress content without first logging into the asp.net core app via identity.

任何帮助将不胜感激!

谢谢!

推荐答案

您可以使用 app.Map 为管道创建新分支

You can use app.Map to create a new branch for your pipeline

app.Map(new PathString("/content"), wordpressApp =>
{
    wordpressApp.UseWordPress();
});

这篇关于如何配置asp.net core 2.2应用程序,以使wordpress加载到其自己的子文件夹中而不是root文件夹中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆