I’ve moved WordPress into sub-folder named /site
but the URL now shows http://www.example.com/site
. I want it to show without the /site/
subdirectory.
Here’s my current .htaccess
code
RewriteEngine On
RewriteBase /site/
RewriteRule ^index.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /site/index.php [L]
How do I remove the physical subdirectory from the visible URL?
I advice you against messing up the contents of the .htaccess file. Revert the changes that you’ve made to this file and follow the simple procedue.
http://www.example.com/site
http://www.example.com
Save the changes and you should be good to go.
According to Giving WordPress Its Own Directory in the Codex, this is what you need (works for me).
Create a
.htaccess
file in root folder, and put this content inside (just change example.com and my_subdir):There you will also find instructions to do it by changing the URL in the General Settings, which also requires you to copy .htaccess and index.php, and then edit this last. The first method seems easier.
Try following steps:-
to the following, using your directory name for the WordPress core files: