htaccess的重定向所有页面单页重定向、页面、htaccess

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

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

 重定向301 / http://www.thenewdomain.com/
 

解决方案

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

  

RewriteEngine叙述上

     

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

301重定向怎么做

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 / http://www.thenewdomain.com/

解决方案

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

RewriteEngine on

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

阅读全文

相关推荐

最新文章