Redirecting a site hostname in Bitnami WordPress

Let’s say you have an Amazon EC2 Bitnami WordPress image, and you need to relocate your url to a new hostname, whether it be for rebranding or simplification.

You can force your URL to instantly redirect to your new domain name.

In this example¬†let’s assume:

  • The new domain name points to the same server your old one was. (for the example, we’ll call it
  • You only have one WordPress vhost on this install. (a standard bitnami WordPress app roll out)
  • You have already pointed your new DNS name to your A record ( and both point to the same instance)

To achieve this redirect, first you must access your SSH terminal and connect to your bitnami stack.

Once in, you should back up, then edit your bitnami wordpress config file.

#cp /opt/bitnami/apps/wordpress/conf/wordpress.conf /opt/bitnami/apps/wordpress/conf/wordpress.conf.bak

#nano /opt/bitnami/apps/wordpress/conf/wordpress.conf

Add the following lines somewhere before the <directory> tag

#New URL redirection
<If "%{HTTP_HOST} != ''">
        Redirect /

Remember to update the fields to match your desired new hostname.

What this snippet does is fairly simple. IF the http host does not equal ‘’ change it to that.

Once you’ve saved your changes. You need to restart apache.

#sudo /opt/bitnami/ restart apache

For best performance, you should also update your WordPress configuration to point to the new hostname in the WordPress url and site url (set in settings/general).

Don’t forget to save your server some work by also updating all of the URLs throughout your content.

I prefer using the Velvet Blues Update URLs plugin for WordPress.
Thanks, good luck!