如何将 www.mydomain.net 重定向到 www.mydomain.net/blog

发布于 2024-07-21 07:02:05 字数 133 浏览 1 评论 0原文

我正在使用“Ionics Isapi Rewrite Filter”,

我有一个根目录为空的网站 www.mydomain.net,我希望,当有人使用此网址时,重定向到我的博客 www.mydomain.net/blog,这怎么可能?。

I'm using 'Ionics Isapi Rewrite Filter'

I have a web site with a empty root www.mydomain.net and I want, when someone use this url, redirect to my blog www.mydomain.net/blog, how is it possible?.

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

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

发布评论

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

评论(3

我爱人 2024-07-28 07:02:05

您不需要重写器来执行重定向。

您可以使用文档根目录中的默认文档(例如,index.html)来执行此操作,其中包含元刷新标记。

index.html 的内容可能是这样的:

<META HTTP-EQUIV=Refresh CONTENT="0; URL=blog">

现在,如果您确实想要 REWRITE,那就不同了。

You don't need a rewriter to do REDIRECT.

You can do that with a default document (like, say, index.html) in the docroot, with a Meta Refresh tag in it.

The content of index.html might be like this:

<META HTTP-EQUIV=Refresh CONTENT="0; URL=blog">

Now if you actually want a REWRITE, that is different.

深爱成瘾 2024-07-28 07:02:05

我假设由于您使用的是在 IIS 上运行的 Isapi Rewrite 过滤器(此答案适用于其他服务器,但我的说明专门针对 IIS)。 您确实不想使用元刷新,并且出于 SEO 目的,您希望使用永久(301) 改为重定向。

在 IIS 中,您可以通过以下方式执行此操作:

  1. 创建一个空的 index.html 页面
  2. 在 IIS 中右键单击该页面并打开“属性”对话框
  3. 在“文件”选项卡上,选择“重定向到 URL”
  4. 将“重定向到”值更改为 http://www.mydomain.net/blog
  5. 选中“此资源的永久重定向”复选框

I'm going to assume that since you're using the Isapi Rewrite filter that you're running on IIS (this answer works for other servers but my instructions are specifically for IIS). You really don't want to use meta refresh and for SEO purposes you want to use a permanent (301) redirect instead.

In IIS you do this by:

  1. Create an empty index.html page
  2. Right click on that page in IIS and open the Properties dialog
  3. On the File tab, select "A redirection to a URL"
  4. Change the "Redirect to" value to http://www.mydomain.net/blog
  5. Check the "A permanent redirection for this resource" checkbox
[浮城] 2024-07-28 07:02:05

以下是 ISAPI_Rewrite 3 Lite(免费)的解决方案:

RewriteBase /
RewriteCond %{HTTP_HOST ^www\.mydomain\.net$ [NC]
RewriteRule ^$ /blog [NC,R=301,L]

Here's the solution for ISAPI_Rewrite 3 Lite (which is free):

RewriteBase /
RewriteCond %{HTTP_HOST ^www\.mydomain\.net$ [NC]
RewriteRule ^$ /blog [NC,R=301,L]
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文