CentOS 7.x Redirect bitnami wordpress from /wordpress to /

From Notes_Wiki

Home > CentOS > CentOS 7.x > Web Based Tools > Wordpress > CentOS 7.x Redirect bitnami wordpress from /wordpress to /

If bitnami installer is used it creates wordpress site at http://<FQDN>/wordpress. Many people prefer to not have /wordpress sub-folder. To redirect bitnami wordpress such that it works directly at / instead of /wordpress use:

  1. Open /opt/wordpress-5.0.3-2/apps/wordpress/conf/httpd-prefix.conf and update to
    #Alias /wordpress/ "/opt/wordpress-5.0.3-2/apps/wordpress/htdocs/"
    #Alias /wordpress "/opt/wordpress-5.0.3-2/apps/wordpress/htdocs"
    Alias / "/opt/wordpress-5.0.3-2/apps/wordpress/htdocs/"
    Include "/opt/wordpress-5.0.3-2/apps/wordpress/conf/httpd-app.conf"
    It is very important to Alias / with the path ending with / as shown above without that access denied message would be received
  2. Edit /opt/wordpress-5.0.3-2/apps/wordpress/conf/httpd-app.conf and update as follows
    1. Change RewriteBase as
      RewriteBase /
      # RewriteBase /wordpress/
    2. Change final rewrite rule to:
      RewriteRule . /index.php [L]
    3. Comment banner config
      # Include "/opt/wordpress-5.0.3-2/apps/wordpress/conf/banner.conf"
  3. Edit /opt/wordpress-5.0.3-2/apps/wordpress/htdocs/wp-config.php and update
    #define('WP_SITEURL', 'http://' . $_SERVER['HTTP_HOST'] . '/wordpress');
    #define('WP_HOME', 'http://' . $_SERVER['HTTP_HOST'] . '/wordpress');
    define('WP_SITEURL', 'http://' . $_SERVER['HTTP_HOST'] . '/');
    define('WP_HOME', 'http://' . $_SERVER['HTTP_HOST'] . '/');
  4. Restart apache for new settings to take effect:
    /opt/wordpress-5.0.3-2/ctlscript.sh restart apache


Home > CentOS > CentOS 7.x > Web Based Tools > Wordpress > CentOS 7.x Redirect bitnami wordpress from /wordpress to /