Moving wordpress setup to subdirectory

Arun - 24/10/2020 1:53 PM

Source Document

Method I (Without URL change) Method I (Without URL change)

1) After Installing the wordpress in root folder, move EVERYTHING from root folder into subdirectory.

2) Create a .htaccess file in root folder, and put this content inside (just change example.com and my_subdir):

Files 1

htaccess
text
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{HTTP_HOST} ^(www.)?example.com$
RewriteCond %{REQUEST_URI} !^/my_subdir/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /my_subdir/$1
RewriteCond %{HTTP_HOST} ^(www.)?example.com$
RewriteRule ^(/)?$ my_subdir/index.php [L] 
</IfModule>