How To Move Wordpress To a Subdirectory

Posted in Code on September 2, 2017 ‐ 1 min read

The view and expressions on this post are my own and do not necessarily represent the postings, strategies or opinions of my employer. [Disclaimer]

  1. Change .htaccess in the subdirectory, i.e. example, where Wordpress now sits
# BEGIN WordPress

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /example
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /example/index.php [L]
</IfModule>

# END WordPress
  1. Edit wp-config.php and add the following lines
define('WP_HOME','https://domain.com/example');
define('WP_SITEURL','https://domain.com/example');