apache - Htaccess 规则将域重定向到 index.html

标签 apache unix .htaccess redirect webserver

如何编写将访问者重定向到域 www.mydomain.com/ 的重写规则至 www.mydomain.com/index.html ?

最佳答案

所以你不想重定向任何东西( ^$ )到 index.html ?那看起来像

RewriteRule ^$ index.html [L]

如果您想同时避免 //index.html被搜索机器人索引,然后添加 R=301使其成为 permanent redirect而不是 temporary redirect (302,这是默认值)。这会让机器人只索引 /index.html .
RewriteRule ^$ index.html [R=301,L]

关于apache - Htaccess 规则将域重定向到 index.html,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1911417/

相关文章:

unix - 在文件中搜索精确的多个模式并在模式匹配时删除行

node.js - 在 apache2 服务器上的 express Node js 中提供静态文件时自动重定向而无需代理传递名称

python - 学习开发、部署和/或托管 Django 的最佳书籍和资源是什么?

python - AF_INET 和 PF_INET 常量有什么区别?

linux - 从 google 搜索 URL 中删除 index.php

.htaccess - 使用 htaccess 将domain.com重定向到www.domain.com

apache - htaccess 在子目录中不起作用

macos - 如何在 Mac Os X 上将用户添加到 apache 组?

php - 我的浏览器节目的我的.php文件内容

unix - 为什么使用 `clone` 创建进程会导致内存不足故障?