html - 重定向 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
提前致谢
解决方案
推荐阅读
- java - 如何修复缓存模式注册表查找导致糟糕的性能
- python - mysql 查询函数在 python shell 中工作,但在 python 中运行时出现错误配置错误
- sql - SQL Server Varchar 军事日期格式 YYYY-MM-DD
- javascript - 将 N 个正奇数相乘
- java - HIbernate 不会创建另一个数据库中已经存在的表
- c# - 尝试从 JSON 对象中获取值会冻结任务
- ruby-on-rails - 带有 ActiveAdmin 的 text_field_tag
- html - 为什么不(点击)将我的数据发送到里面
- python - Apache Ignite 插入速度极慢
- conv-neural-network - 如何训练一个 CNN 模型?