nativeInstallerwordpress

Move WordPress to a different URL path on the same domain

Before running the commands shown on this page, you should load the Bitnami stack environment by executing the installdir/use_APPNAME script (Linux and MacOS) or by clicking the shortcut in the Start Menu under “Start -> Bitnami APPNAME Stack -> Application console” (Windows). On OS X VMs, the installation directory is /opt/bitnami and OS X VM users can click the “Open Terminal” button to run commands. Learn more about the Bitnami stack environment and about OS X VMs.

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

  • Log in to the server console using SSH.
  • Edit the installdir/apps/wordpress/conf/httpd-prefix.conf file and find the lines below:

    #Alias /wordpress/ "installdir/apps/wordpress/htdocs/"
    #Alias /wordpress "installdir/apps/wordpress/htdocs"
    

    Uncomment and update the Alias directives to reflect the new path. For example, to move WordPress to the /blog path, update the file to look like this:

    Alias /blog/ "installdir/apps/wordpress/htdocs/"
    Alias /blog "installdir/apps/wordpress/htdocs"
    
  • Look for the lines below in the file installdir/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 Apache:

    $ sudo installdir/ctlscript.sh restart apache
    
Last modification September 6, 2018