我是新来的AWS光帆。
我已经成功地将我的web应用程序迁移到了LAMP服务器(bitnami),并生成了SSL证书。现在我想重定向到HTTP到HTTPS。因此,我创建了.htaccess并复制了下面的代码,并重新启动了服务器。但是页面不是从http迁移到https的。你能帮我启用.htaccess吗
由于我计划主持3个网站,我正在寻找.htaccess,以便我可以配置本地基础条件。
RewriteEngine On
RewriteCond %{HTTP_HOST} ^test\.in [NC]
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.test.in/$1 [R,L]谢谢。
发布于 2020-02-19 09:57:14
Bitnami工程师:
默认情况下,由于安全性和性能原因,我们禁用.htaccess文件。我们还将.htaccess文件内容移到/opt/bitnami/app/APPNAME/conf文件夹中的一个名为htaccess.conf的文件中。您可以在https://docs.bitnami.com/aws/infrastructure/lamp/administration/use-htaccess/查看更多有关它的信息。
如果要启用.htaccess使用,则需要将其设置为/opt/bitnami/apache2/conf/bitnami/bitnami.conf文件中的AllowOverride All:
<VirtualHost _default_:80>
DocumentRoot "/opt/bitnami/apache2/htdocs"
<Directory "/opt/bitnami/apache2/htdocs">
Options Indexes FollowSymLinks
AllowOverride All <---- HERE
<IfVersion < 2.3 >
Order allow,deny
Allow from all
</IfVersion>
<IfVersion >= 2.3 >
Require all granted
</IfVersion>
</Directory>应用更改后重新启动Apache。
问候
发布于 2020-12-10 23:11:12
apps/wordpress/conf
htaccess文件将打开。根据您的要求编辑它,然后按ctrl +x退出,确保按y键保存更改。重新启动lightsail实例。好了。
发布于 2020-10-11 04:56:30
如果您已经配置了SSL配置,那么在您的vhost文件中添加重定向选项,这必须是您为网站在线查看所创建的。
无论您对服务器做了什么修改,请确保创建备份,并始终尝试创建新的修改文件。因此,您可以在应用程序的虚拟主机文件上使用重定向选项。
<VirtualHost *:80>
ServerName your_domain_name.com
ServerAlias www.your_domain_name.com
Redirect permanent / https://www.your_domain_name.com/
DocumentRoot /opt/bitnami/apache2/htdocs
<Directory "/opt/bitnami/apache2/htdocs">
Options -Indexes +FollowSymLinks -MultiViews
AllowOverride All
Require all granted
</Directory>
</VirtualHost>希望这对你有用。
https://stackoverflow.com/questions/60281420
复制相似问题