Introduction
You may want to move your WordPress installation to a subfolder and not have the folder name in the URL.
Procedure
- Make the folder to move the site into.
- Move the files and folders from the document root to the new folder.
- Create a new
.htaccess
file in the document root. - Open the new
.htaccess
file in your preferred text editor. - Add the following to the
.htaccess
file.<IfModule mod_rewrite.c> RewriteEngine on RewriteCond %{HTTP_HOST} ^(www.)?$domain.tld$ RewriteCond %{REQUEST_URI} !^/$newfolder/ RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ /$newfolder/$1 RewriteCond %{HTTP_HOST} ^(www.)?$domain.tld$ RewriteRule ^(/)?$ $newfolder/index.php [L] </IfModule>
Please note that "$domain.tld" and "$newfolder" must be replaced with your site's domain name and the new folder name, respectively. - Save the changes and exit the text editor.