Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/wordpress/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/.htaccess/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Wordpress 是否有办法将2个域转发到1个HTAAAccess文件中的HTTPS地址?_Wordpress_.htaccess_Redirect_Https - Fatal编程技术网

Wordpress 是否有办法将2个域转发到1个HTAAAccess文件中的HTTPS地址?

Wordpress 是否有办法将2个域转发到1个HTAAAccess文件中的HTTPS地址?,wordpress,.htaccess,redirect,https,Wordpress,.htaccess,Redirect,Https,我有一个.com和一个.com.au地址用于同一个域。我让它们都指向DNS中的同一主机。但由于我当前的htaaccess文件,它们都变成了.com.au 我是编辑这些文件的新手,并尝试过使用一些我找到的解决方案,但似乎没有一个有效,我总是在.com.au地址看到https # BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^index\.php$ - [L] Re

我有一个.com和一个.com.au地址用于同一个域。我让它们都指向DNS中的同一主机。但由于我当前的htaaccess文件,它们都变成了.com.au

我是编辑这些文件的新手,并尝试过使用一些我找到的解决方案,但似乎没有一个有效,我总是在.com.au地址看到https

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
RewriteCond %{SERVER_PORT} 80 
RewriteRule ^(.*)$  https://www.domainname.com.au/$1 [R,L]
</IfModule>
#开始WordPress
重新启动发动机
重写基/
重写规则^index\.php$-[L]
重写cond%{REQUEST_FILENAME}-F
重写cond%{REQUEST_FILENAME}-D
重写规则/index.php[L]
重写cond%{SERVER_PORT}80
重写规则^(.*)$https://www.domainname.com.au/$1[R,L]
这是我使用的原始代码。如果有人知道如何编辑此文件以重定向到,那就太好了。

您可以使用:

 RewriteEngine on

 RewriteBase /
#http to https (two specific domains)
RewriteCond %{SERVER_PORT} 80
RewriteCond %{HTTP_HOST} (a\.com|a\.com\.au)$ [NC]
RewriteRule (.*) https://www.%1%{REQUEST_URI} [L,R=301]
# BEGIN WordPress
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
a\.com
a\.com\.au
替换为上述
%{HTTP\u HOST}
条件模式中的实际域。

您可以使用以下方法:

 RewriteEngine on

 RewriteBase /
#http to https (two specific domains)
RewriteCond %{SERVER_PORT} 80
RewriteCond %{HTTP_HOST} (a\.com|a\.com\.au)$ [NC]
RewriteRule (.*) https://www.%1%{REQUEST_URI} [L,R=301]
# BEGIN WordPress
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

a\.com
a\.com\.au
替换为上述
%{HTTP\u HOST}
条件模式中的实际域。

谢谢您的回复,我已经尝试过了,该.com将重定向到.com.au地址,而不是更改https,该.com.au也没有更改。我是否正确地更新了它?RewriteBase/#http to https(两个特定域)RewriteCond%{SERVER_PORT}80 RewriteCond%{http_HOST}(mydomain.com | mydomain.com.au)$[NC]RewriteRule(.*){REQUEST_URI}[L,R=301]#BEGIN WordPress RewriteRule^ index\.php$-[L]RewriteCond%{REQUEST_FILENAME}-f RewriteCond%{REQUEST_FILENAME}-重写规则/index.php[L]@N.Dance为什么要删除
https://www.
代码中的一部分?按原样使用我的代码。如果问题仍然存在,请尝试清除浏览器的缓存。我没有删除它。但上述情况似乎把它变成了一个链接。我唯一更改的一行是这一行重写%{HTTP|u HOST}(domain.com | domain.com.au)$[NC],既不更改https和.com,也不重定向到.com.authankyu以获得您的答复,我已经尝试过了,并且.com正在重定向到.com.au地址而不是更改https,而.com.au也没有更改。我是否正确地更新了它?RewriteBase/#http to https(两个特定域)RewriteCond%{SERVER_PORT}80 RewriteCond%{http_HOST}(mydomain.com | mydomain.com.au)$[NC]RewriteRule(.*){REQUEST_URI}[L,R=301]#BEGIN WordPress RewriteRule^ index\.php$-[L]RewriteCond%{REQUEST_FILENAME}-f RewriteCond%{REQUEST_FILENAME}-重写规则/index.php[L]@N.Dance为什么要删除
https://www.
代码中的一部分?按原样使用我的代码。如果问题仍然存在,请尝试清除浏览器的缓存。我没有删除它。但上述情况似乎把它变成了一个链接。我所更改的唯一一行是重写cond%{HTTP_HOST}(domain.com | domain.com.au)$[NC],既不更改为https,也不更改为.com,也不重定向到.com.au