.htaccess 301将.ca域重定向到.com域

.htaccess 301将.ca域重定向到.com域,.htaccess,redirect,url-redirection,.htaccess,Redirect,Url Redirection,我正在尝试做一个.ca到.com域301重定向,但是无论我做什么,它都不起作用。我以前没有做过这件事,所以我已经仔细研究过了,但是我的代码不起作用?因为my.ca域只是转到一个“找不到”页面。不应该重定向到my.com域 这是我在.htaccess中的代码 RewriteEngine on RewriteCond %{HTTP_HOST} ^example.ca [NC,OR] RewriteCond %{HTTP_HOST} ^example.ca [NC] RewriteRule ^(.*)

我正在尝试做一个.ca到.com域301重定向,但是无论我做什么,它都不起作用。我以前没有做过这件事,所以我已经仔细研究过了,但是我的代码不起作用?因为my.ca域只是转到一个“找不到”页面。不应该重定向到my.com域

这是我在.htaccess中的代码

RewriteEngine on
RewriteCond %{HTTP_HOST} ^example.ca [NC,OR]
RewriteCond %{HTTP_HOST} ^example.ca [NC]
RewriteRule ^(.*)$ http://example.com/$1 [L,R=301,NC]
我有一系列W3TC的规则,我假设这段代码与我们网站上的登录页插件有关:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{QUERY_STRING} !lp-variation-id
RewriteRule ^go/([^/]*)/([0-9]+)/ /go/$1?lp-variation-id=$2 [QSA,L]
RewriteCond %{QUERY_STRING} !lp-variation-id
RewriteRule ^go/([^/]*)? /wp-content/plugins/landing-pages/modules/module.redirect-ab-testing.php?permalink_name=$1  [QSA,L]
RewriteRule ^landing-page=([^/]*)? /wp-content/plugins/landing-pages/modules/module.redirect-ab-testing.php?permalink_name=$1 [QSA,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
#开始WordPress
重新启动发动机
重写基/
重写规则^index\.php$-[L]
重写cond%{QUERY_STRING}!lp变异id
重写规则^go/([^/]*)/([0-9]+)///go/$1?lp变量id=$2[QSA,L]
重写cond%{QUERY_STRING}!lp变异id
是否重写规则^go/([^/]*)/wp content/plugins/landing page/modules/module.redirect ab testing.php?permalink_name=$1[QSA,L]
重写规则^landing page=([^/]*)/wp content/plugins/landing page/modules/module.redirect ab testing.php?permalink_name=$1[QSA,L]
重写cond%{REQUEST_FILENAME}-F
重写cond%{REQUEST_FILENAME}-D
重写规则/index.php[L]

建议很好!谢谢

你的htaccess文件中还有其他规则吗?我已经更新了问题的底部来回答你,Jon。