我目前正在使用Apache托管网站的AWS实例。我已经设置了我的SSL,我可以转到https://example.com就好了,但是当我转到http://example.com时,我没有被重定向。有了这个,我尝试了以下内容:
sudo a2ensite example.com.conf
这是我的.conf
<VirtualHost *:80>
ServerName example.com
ServerAlias example.com *.example.com
Redirect permanent / https://example.com/
#RewriteEngine On
#RewriteRule ^(.*)$ https://%{HTTP_HOST}$1 [R=301,L]
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
<IfModule mod_ssl.c>
<VirtualHost _default_:443>
... all my site stuff
</IfModule>
我将非常感谢能够提供帮助的任何人。非常感谢你。
答案 0 :(得分:0)
更改/etc/apache2/apache2.conf
=&gt;全部更改所有AllowOverride
,
并确保/etc/apache2/sites-available/000.default.conf
=&gt;验证您访问的目录的路径。
ServerAdmin webmaster@localhost
DocumentRoot /var/www/floder that you acess /public
<Directory /var/www/ninja/public>
AllowOverride All
</Directory>