Redirect &引用;添加重定向时出错。重定向将导致重定向循环“;

Redirect &引用;添加重定向时出错。重定向将导致重定向循环“;,redirect,cpanel,Redirect,Cpanel,在创建附加域后,我在添加重定向部分的cpanel中遇到此错误: There was an error adding the redirect. Redirecting "https://example.com" will cause a redirection loop because "http://.*/", which is located at "/home/folder/", is above "https://example.com", which is located at

在创建附加域后,我在添加重定向部分的cpanel中遇到此错误:

There was an error adding the redirect. Redirecting "https://example.com" 
will cause a redirection loop because "http://.*/", which is located at 
"/home/folder/", is above "https://example.com", which is located at 
"/home/folder/"
  • 类型=永久(301)重定向
  • 所有公共域
  • 重定向到:“
  • 通配符重定向

最好是通过cpanel,目标是仅通过301重定向进行重定向,用于SEO目的,并将主域重定向到附加域。如何修复此循环?谢谢

您可以通过.htaccess使用

使用此代码编辑:

#Force www:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^yourdomain.com [NC]
RewriteRule ^(.*)$ http://www.yourdomain.com/$1 [L,R=301,NC]
使用您的域名更改yourdomain.com。这是我的工作