Move WordPress to a different URL path on the same domain with NGINX

By default, WordPress is available at the domain or IP address root URL, such as http://SERVER-IP or To move WordPress to a different path on the same domain or IP address, such as http://SERVER-IP/blog or, follow these steps:

  • Log in to the server console. Learn how to connect to the server through SSH.

  • Edit the /opt/bitnami/apps/wordpress/conf/nginx-prefix.conf file and update it to reflect the new path:

      location /blog {
          alias "/opt/bitnami/apps/wordpress/htdocs";
          include "/opt/bitnami/apps/wordpress/conf/nginx-app.conf";
  • Look for the lines below in the file /opt/bitnami/apps/wordpress/htdocs/wp-config.php file:

      define('WP_SITEURL', 'http://' . $_SERVER['HTTP_HOST'] . '/');
      define('WP_HOME', 'http://' . $_SERVER['HTTP_HOST'] . '/');

    Modify them to reflect the new path, as below:

      define('WP_SITEURL', 'http://' . $_SERVER['HTTP_HOST'] . '/blog');
      define('WP_HOME', 'http://' . $_SERVER['HTTP_HOST'] . '/blog');
  • Restart NGINX:

      $ sudo /opt/bitnami/ restart nginx
Last modification March 24, 2021