Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/.htaccess/5.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/6/eclipse/8.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
.htaccess 将域的记录指向另一台服务器,并将该子域的任何http重定向到https。_.htaccess_Redirect_Rewrite_Cname - Fatal编程技术网

.htaccess 将域的记录指向另一台服务器,并将该子域的任何http重定向到https。

.htaccess 将域的记录指向另一台服务器,并将该子域的任何http重定向到https。,.htaccess,redirect,rewrite,cname,.htaccess,Redirect,Rewrite,Cname,我在我的主域上创建了一个A记录,指向web应用程序的另一个IP地址。 Ex:account.mydomain.com具有指向第三方服务器Ex:255.255.255.xxx的A记录 我的问题是: 如果有人去:他们收到一个错误。 如果他们去:那就行了 我不能使用重定向,因为该子域只是一个记录。如何修复此问题,使http仅针对记录account.mydomain.com重定向到https 提前感谢您的帮助 将此代码放入文档\u ROOT/.htaccess文件: 试着提供所有的细节只是我做不到这项工

我在我的主域上创建了一个A记录,指向web应用程序的另一个IP地址。 Ex:account.mydomain.com具有指向第三方服务器Ex:255.255.255.xxx的A记录

我的问题是: 如果有人去:他们收到一个错误。 如果他们去:那就行了

我不能使用重定向,因为该子域只是一个记录。如何修复此问题,使http仅针对记录account.mydomain.com重定向到https

提前感谢您的帮助

将此代码放入文档\u ROOT/.htaccess文件:


试着提供所有的细节只是我做不到这项工作对你没有帮助。您尝试了什么URL以及出现了什么错误?我将其添加到了.htaccess文件中,但它没有重新路由到https。我将^account\.mydomain\.com$更改为我的实际A记录和域名。您是否将上述规则放在account.mydomain.com的文档根目录中?您是否启用了.htaccess和mod_重写?
RewriteEngine On

RewriteCond %{HTTP_HOST} ^account\.mydomain\.com$ [NC]
RewriteCond %{HTTPS} off
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,NC,R=301]