Code

Move Wordpress To Subdirectory

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

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    # 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
  2. Edit wp-config.php and add the following lines

    1
    2
    define('WP_HOME','https://domain.com/example');
    define('WP_SITEURL','https://domain.com/example');
#wordpress