首页 > 解决方案 > 重定向 301 不适用于 .html 页面

问题描述

我有一个网站现在移到新域(旧域也处于活动状态)旧 URL 是这样的: http : //example.com/index.html http://example.com/register.html

新的网址是

http://newexample.com/index.html
http://newexample.com/register.html

现在我想将用户从旧域重定向到新域

Redirect 301 / http://newexample.com/index.html

通过在 .htaccess 文件中添加上面的代码,我可以重定向用户,它也可以工作。

但是当有人点击它时http://example.com/index.html它不会重定向

到目前为止我尝试过的解决方案是

Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^example.com[nc]
RewriteRule ^(.*)$ http://www.newexample.com/$1 [r=301,nc]

这个也是

//301 Redirect Old File
Redirect 301 http://example.com/index.html http://newexample.com/index.html

这个也

Redirect 301 /index.html http://newexample.com/index.html

谁能帮我解决这个问题。

旧 URL 是 .html,新 URL 也有 .html

提前致谢

标签: htmlapache.htaccessredirect

解决方案


推荐阅读