如何编写将访问者重定向到域 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/