.htaccess的规则来重定向域名的index.html [英] Htaccess rule to redirect domain to index.html

查看:434
本文介绍了.htaccess的规则来重定向域名的index.html的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我怎样写一个重写规则重定向访问者到域 www.mydomain.com / www.mydomain.com/index html的

How do I write a rewrite-rule that redirects visitors to the domain www.mydomain.com/ to www.mydomain.com/index.html?

推荐答案

所以,你要重定向的没有的( ^ $ )以 index.html的?这将如下图所示。

So you want to redirect nothing (^$) to index.html? That would then look like

RewriteRule ^$ index.html [L]

如果你想避免的两个的的 / /index.html 是被搜索机器人索引,然后添加 R = 301 来使之成为的 永久性的重定向而不是一个的 临时的重定向(302,这是默认值)。这将让机器人只指数 /index.html

If you want to avoid both the / and /index.html being indexed by search bots, then add R=301 to make it a permanent redirect rather than a temporary redirect (302, which is the default). This would let the bots only index the /index.html.

RewriteRule ^$ index.html [R=301,L]

这篇关于.htaccess的规则来重定向域名的index.html的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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