I am pretty fresh to URL rewrites, and AWS for that matter. I installed Wordpress on an AWS EC2 micro instance and I would like to make is so that my site always redirects the www.domain.com to domain.com.
I followed the instruction from Bitnami here and the site is still accessible but it is still accessible from www.domain.com.
Here is the httpd-vhost.conf file:
<VirtualHost *:80>
ServerName wordpress.example.com
ServerAlias www.wordpress.example.com
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ http://%1$1 [R=permanent,L]
DocumentRoot "/opt/bitnami/apps/wordpress/htdocs"
Include "/opt/bitnami/apps/wordpress/conf/httpd-app.conf"
</VirtualHost>
<VirtualHost *:443>
ServerName wordpress.example.com
ServerAlias www.wordpress.example.com
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ https://%1$1 [R=permanent,L]
DocumentRoot "/opt/bitnami/apps/wordpress/htdocs"
SSLEngine on
SSLCertificateFile "/opt/bitnami/apps/wordpress/conf/certs/server.crt"
SSLCertificateKeyFile "/opt/bitnami/apps/wordpress/conf/certs/server.key"
Include "/opt/bitnami/apps/wordpress/conf/httpd-app.conf"
</VirtualHost>
I have since rebooted the instance and nothing seems to change. Am I missing something?
I am very grateful for any help!