htaccess的重定向所有页面单页

编程入门 行业动态 更新时间:2024-10-26 02:35:12
本文介绍了htaccess的重定向所有页面单页的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我想用htaccess文件重定向我所有的旧域名请求,我的新域名。下面是我使用的是什么,但它不工作,如果页面无法在新网站上。例如谷歌在老站点索引about.htm中,但在新网站上不存在。我想它只是去根在所有情况下。我知道这是不是理想的搜索引擎优化,但我不希望任何404。有什么建议?

重定向301 / www.thenewdomain/

解决方案

您试图让游人old/about.htm~~V去new/about.htm~~V?如果是的话,你可以在.htaccess一个mod_rewrite的规则做到这一点:

  

RewriteEngine叙述上

     

重写规则^(。*)$ www.thenewdomain/ $ 1 [R =永久的,L]

I want to redirect all of my old domain request to my new domain using htaccess file. Below is what I am using but it does not work if the page is not on the new site. For example google index about.htm on the old site but on the new site it does not exist. I would like it to just go to the root in all cases. I know this is not ideal for seo but I don't want any 404s. Any suggestions?

Redirect 301 / www.thenewdomain/

解决方案

Are you trying to get visitors to old/about.htm to go to new/about.htm? If so, you can do this with a mod_rewrite rule in .htaccess:

RewriteEngine on

RewriteRule ^(.*)$ www.thenewdomain/$1 [R=permanent,L]

更多推荐

htaccess的重定向所有页面单页

本文发布于:2023-10-31 16:41:06,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1546667.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:重定向   页面   htaccess

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!