How To Move Wordpress To a Subdirectory

Steps to move Wordpress to a subdirectory.

How To Move Wordpress To a Subdirectory

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

  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');