将一个域和每个子页面重定向到另一个域 [英] Redirect one domain and every sub-page to a different domain

查看:65
本文介绍了将一个域和每个子页面重定向到另一个域的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经阅读了很多有关此问题的文章,并尝试了许多策略.但是,我仍然无法将Peaceandtruth.com的所有子页面重定向到oldmankit.com,这是我想要的.我的情况可能有些混乱,因为我正在使用一个带有附加域的共享托管帐户. oldmankit.com是附加域.

I have read numerous people with this question and have tried numerous strategies. However, I am still unable to redirect all sub-pages for peaceandtruth.com over to oldmankit.com, which is what I want. My situation may be a little confused because I am using one shared hosting account with an add-on domain. oldmankit.com is the addon domain.

这是我的.htaccess文件:

Here is my .htaccess file:

Options +FollowSymLinks
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} !^peaceandtruth\.com$ [NC]
RewriteRule ^(.*)$ http://oldmankit.com [R=301,L]

如果您访问 http://peaceandtruth.com/me/,则会看到它是不重定向.

If you go to http://peaceandtruth.com/me/, you will see that it is not redirecting.

非常感谢您的帮助.

推荐答案

RewriteCond %{HTTP_HOST} !^peaceandtruth\.com$ [NC]

这表示如果HTTP_HOST为 peaceandtruth.com ". 丢失惊叹号,表示正面匹配.

This means "If HTTP_HOST is NOT peaceandtruth.com". Lose the exclamation mark for a positive match.

这篇关于将一个域和每个子页面重定向到另一个域的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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