# Redirects on AWS Lightsail WordPress

AWS Lightsail (Bitnami) doesn’t enable overrides using .htaccess by default and the structure of the Apache config files is, at best, confusing.

The quick and easy solution is to use:

/opt/bitnami/apache2/conf/bitnami/bitnami-apps-prefix.conf

The most common redirects are WWW to non-WWW and HTTP to HTTPS. So you don’t have to root around the internet for those, here they are. Just throw the rules below at the end of the file above.

## WWW to Non-WWW

An example of this is having www.codingwithcody.com redirect to codingwithcody.com (go ahead and try it out, I use this rule on this site).

RewriteEngine On

## All Together Now

After connecting to your machine:

sudo nano /opt/bitnami/apache2/conf/bitnami/bitnami-apps-prefix.conf

Copy and paste the rule you are looking for from above (or both, but you only need the “RewriteEngine On” line once before the rules).

And, finally, restart the Apache and PHP-FPM services:

sudo /opt/bitnami/ctlscript.sh restart

After the services come back up, you should be all set.