Laravel对待www和非www不同

时间:2018-08-06 06:49:42

标签: laravel ssl vhosts

我有Windows Server,并且有godaddy域。我从godaddy那里获取了SSL并申请了我的服务器。我的域通过SSL获得安全保护,但是问题出在什么时候,我从https://www.example.com重定向并登录它显示了仪表板,但是当我将url更改为https://example.com时,它将我重定向到登录页面。

这是我的VHOST文件

<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot "C:/mcpluat/xampp/htdocs/project/public"
ServerName www.example.com
ServerAlias example.com

RewriteEngine on

RewriteCond %{SERVER_PORT} 80  
RewriteRule ^(.*)$ https://www.example.com/ [R,L]

<Directory "C:/mcpluat/xampp/htdocs/project/public">
  Options Indexes FollowSymLinks Includes ExecCGI
   AllowOverride All
   Require all granted
</Directory>
</VirtualHost>

.HTACCESS文件

             选项-MultiViews-索引     

RewriteEngine On

# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} (.+)/$
RewriteRule ^ %1 [L,R=301]

# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]

一切运行正常,但为什么将www.example.com和example.com视为另一个域

预先感谢

0 个答案:

没有答案