Move WordPress to a different URL path on the same domain with Apache
By default, WordPress is available at the domain or IP address root URL, such as http://SERVER-IP or http://example.com. To move WordPress to a different path on the same domain or IP address, such as http://SERVER-IP/blog or http://example.com/blog, follow these steps:
-
Edit the /opt/bitnami/apps/wordpress/conf/httpd-prefix.conf file and find the lines below:
#Alias /wordpress/ "/opt/bitnami/apps/wordpress/htdocs/" #Alias /wordpress "/opt/bitnami/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/ "/opt/bitnami/apps/wordpress/htdocs/" Alias /blog "/opt/bitnami/apps/wordpress/htdocs"
-
Edit the /opt/bitnami/apps/wordpress/conf/httpd-app.conf file and find the lines below:
#RewriteBase /wordpress/ RewriteRule . index.php [L]
Uncomment and update the directives to reflect the new path. For example, to move WordPress to the /blog path, update the file to look like this:
RewriteBase /blog/ RewriteRule . /blog/index.php [L]
-
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 Apache:
$ sudo /opt/bitnami/ctlscript.sh restart apache