简体   繁体   English

ASP.NET Url 重写子域 Wordpress II7 Web.Config

[英]ASP.NET Url Rewrite Subdomain Wordpress II7 Web.Config

I have a server that host a variety of asp.net sites on a IIS7 server.我有一台服务器,在 IIS7 服务器上托管各种 asp.net 站点。 A few of those sites have wordpress blogs in a folder called blog (which is obviously written in PHP).其中一些站点在名为 blog(显然是用 PHP 编写的)的文件夹中有 wordpress 博客。 Due to security issues, we need to move those wordpress blogs to a linux server.由于安全问题,我们需要将那些 wordpress 博客移至 linux 服务器。

So instead of http://www.domainname.com/blog we now have http://blog.domainname.com/ which has the blog url.因此,我们现在使用http://blog.domainname.com/代替了http://www.domainname.com/blog ,其中包含博客 url。

The only problem is, due to SEO reasons, we need the blog to be on the same domain as the main site (which is written in ASP.NET).唯一的问题是,由于 SEO 的原因,我们需要博客与主站点(用 ASP.NET 编写)在同一个域中。

My question is, is there a way to do a url rewrite so that if someone types in a wordpress link, similar to this:我的问题是,有没有办法进行 url 重写,以便如果有人输入 wordpress 链接,类似于:

http://www.domainname.com/blog/index.php/archives/category/mycategory http://www.domainname.com/blog/index.php/archives/category/mycategory

Can I use a web config URL rewrite to have the above typed in URL actually point to我可以使用 web 配置 URL 重写来让上面输入的 URL 实际指向

http://blog.domainname.com/index.php/archives/category/banking http://blog.domainname.com/index.php/archives/category/banking

I can't do any sort of redirect.我不能做任何类型的重定向。 It has to be a rewrite, I've tried righting one myself but have been unable to.它必须是重写的,我已经尝试过自己纠正,但一直无法做到。 The subdomain is the part of the rewrite I can't get past.子域是我无法通过的重写部分。

Has anyone tried to do this before?有没有人试过这样做? Is there some better way I go about this if not.如果没有,我有没有更好的方法来解决这个问题。

Keep in mind the blog and the asp.net site cannot be on the same server due to security reasons, but they must keep the same domain name.请记住,出于安全原因,博客和 asp.net 站点不能在同一台服务器上,但它们必须保持相同的域名。

You can't just do a rewrite as the URL you want to rewrite to is on another domain / website.您不能只进行重写,因为要重写的 URL 位于另一个域/网站上。 Rewrites only work on the same website.重写只能在同一个网站上工作。

You have to setup IIS as a reverse proxy server with the ARR module .您必须使用ARR 模块将 IIS 设置为反向代理服务器。 In combination with the URL rewrite module you will be able to invisibly forward all requests for http://www.domainname.com/blog/* to http://blog.domainname.com/* .结合 URL 重写模块,您将能够无形地将所有对http://www.domainname.com/blog/*请求转发到http://blog.domainname.com/*

Also note that you will have to setup outbound rewriting in order to change back the URL's that are generated by Wordpress (from http://blog.domainname.com/* back to http://www.domainname.com/blog/* ).另请注意,您必须设置出站重写才能将 Wordpress 生成的 URL 改回(从http://blog.domainname.com/*返回到http://www.domainname.com/blog/* )。

See for an example this tutorial: Reverse Proxy with URL Rewrite v2 and Application Request Routing .有关示例,请参阅本教程: 具有 URL 重写 v2 和应用程序请求路由的反向代理

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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