与htaccess的重定向问题(页上的一个域名同一页上的另一个) [英] Problems with htaccess Redirect (Page on one domain to same page on another)

查看:136
本文介绍了与htaccess的重定向问题(页上的一个域名同一页上的另一个)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想重定向几页到一个新的领域,我以前做过这一点,但由于某种原因,我不能得到code工作。

I'm trying to redirect a few pages to a new domain and I have done this before but for some reason I can't get the code to work.

RewriteEngine On
Redirect 301 http://domain.com/page1.html http://domain2.com/page1.html

有人能看到我要去哪里错了?

Can anyone see where I'm going wrong?

推荐答案

既然你说你只需要指挥你的网页的一些,而不是所有的人,你可以这样做:

Since you say you only want to direct a FEW of your pages and not all of them, you can do:

RewriteEngine On
Redirect /~myaccount/oldpage.html http://www.newsite.com/newpage.html

您指定的路径页当前服务器后面的URL重定向到。

You specify the path to the page on your current server followed by the URL to redirect to.

或者你可以这样做:

RedirectMatch 301 ^/oldpage\.html$ http://www.newsite.com/newpage.html

这篇关于与htaccess的重定向问题(页上的一个域名同一页上的另一个)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆