Helicon 重定向到 IIS6 虚拟目录 - .htaccess 语法和位置

发布于 2024-07-26 06:01:48 字数 958 浏览 6 评论 0原文

我正在将位于 IIS 6 Web 服务器上的物理文件夹 (/blog/) 中的博客移动到运行 BlogEngine.net 的同名虚拟目录 (blog),该虚拟目录与以下应用程序池运行在同一应用程序池中父网站。

我想将每个 .html 帖子重定向到新的 BlogEngine.net URL。 例如

http://www.mywebsite.co .uk/blog/2009/06/old-blog-title.html http://www.mywebsite.co.uk/blog/ post/new-blog-title.aspx

我已经在我的网站上运行了 Helicon ISAPI Rewrite 版本 3.1.0.58,并且目前重定向工作正常。 但重定向到博客虚拟目录似乎不起作用。

当前 .htaccess 规则:

#rewriterule ^blog/2009/06/old-blog-title.html$ /blog/post/new-blog-title.aspx [R=301,L]

问题 1: 我应该将 .htaccess 规则添加到博客虚拟目录根目录还是主网站根目录?

问题 2: 我应该使用什么 .htaccess 语法来重定向到虚拟目录?

在此先感谢您的帮助。

I'm moving my blog which was in a physical folder (/blog/) on my IIS 6 web server to a virtual directory called the same name (blog) running BlogEngine.net, the virtual directory is running in the same application pool as the parent website.

I want to redirect each .html post to the new BlogEngine.net URL. e.g.

http://www.mywebsite.co.uk/blog/2009/06/old-blog-title.html
to
http://www.mywebsite.co.uk/blog/post/new-blog-title.aspx

I already have Helicon ISAPI Rewrite Version 3.1.0.58 running on my website and currently have redirects working fine. But redirects to the blog virtual directory don't seem to work.

Current .htaccess rule:

#rewriterule ^blog/2009/06/old-blog-title.html$ /blog/post/new-blog-title.aspx [R=301,L]

Question 1: Should I add the .htaccess rules to the blog Virual Directory root or the main website root?

Question 2: What .htaccess syntax should I be using to redirect to the virtual directory?

Thanks in advance for your help.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

怎言笑 2024-08-02 06:01:48

我没有得到任何回应,但自己设法弄清楚了。 有 StackOverflow 徽章吗?哈哈:-)
我正在回答我自己的问题,以防其他人也遇到同样的问题。

问题 1 的答案

.htaccess 文件应位于虚拟目录根目录中,但您无法在虚拟目录的 IIS 6 的 Helicon Rewrite 选项卡中编辑此文件,因为它要保存 .htaccess 文件。 htaccess 文件位于名为 /blog/ 的物理目录而不是虚拟目录中。

问题 2 的回答

由于 .htaccess 文件位于虚拟目录中,因此需要稍微修改重写。 基本上从旧网址的开头删除 blog/ 。

rewriterule ^2009/06/old-blog-title.html$ /blog/post/new-blog-title.aspx [R=301,L]

I didn't get any response, but managed to figure it out myself. Is there a StackOverflow badge for that LOL :-)
I'm answering my own question just incase anyone else has the same problem.

Answer to Question 1

The .htaccess file should be located in the virtual directory root, but you can't edit this in the Helicon Rewrite tab of IIS 6 for the virtual directory as it wants to save the .htaccess file in a physical directory called /blog/ rather than the virtual directory.

Answer to Question 2

The rewrite needed to be amended slightly due to the .htaccess file location within the virtual directory. Basically removing blog/ from the beginning of the old url.

rewriterule ^2009/06/old-blog-title.html$ /blog/post/new-blog-title.aspx [R=301,L]
眼泪淡了忧伤 2024-08-02 06:01:48

如果您只需要重定向几篇博客文章,那么您的规则是可以的,但如果您有数百篇博客文章,您最好看看 ISAPI_Rewrite 此处

但您无法在 IIS 6 的 Helicon Rewrite 选项卡中为虚拟目录编辑此内容

此问题已在 build 62 中修复,因此请更新并享受。

Your rule is OK if you need to redirect just a couple of blog articles, but if you'll have hundreds of them, you'd better have a look at mapfiles functionality of ISAPI_Rewrite here.

but you can't edit this in the Helicon Rewrite tab of IIS 6 for the virtual directory

This problem was fixed in build 62, so update and enjoy.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文