my website hosted on ec2 - AWS. I want to add www in my website. Also my website has ssl. I am not able to add www in my website. I want my website full domain should be start with https://www.
I installed ubantu.
my website hosted on ec2 - AWS. I want to add www in my website. Also my website has ssl. I am not able to add www in my website. I want my website full domain should be start with https://www.
I installed ubantu.
First, connect to your ec2 instance using ssh
After connect successfully go to your root directory using sudo su -
After that run sudo nano /etc/apache2/sites-available/000-default.conf
to open your config file.
then in your vi
editor you have to write below code
ServerName yourdomain.com
ServerAlias www.yourdomain.com
<Directory /var/www/html/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteCond %{HTTP:X-Forwarded-Proto} =http
RewriteRule (.*) https://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
save the file.
And restart your apache server using
service apache2 restart
.
Hope this will help you.