Add Separate Sub Folder Under WordPress

I don’t need to explain the value of WordPress. That can speak for itself. There are times, however, when I come across something that stumps me.

Yesterday a client needed a microsite uploaded to their main WordPress site. So I gathered the code together and uploaded it to a sub folder in the main WordPress path (along with index.php, wp-admin/, etc). We’ll say it was named microsite/. But when I went to load that folder at https://originalsite.com/microsite/, I got a 404 error. Hrmm.

This is because of how WordPress handles URL paths in the .htaccess file. It directs everything through index.php so that it can match it’s permalinks and load the proper content. So I added this to the .htaccess file so the site would load.



RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} ^/microsite/(.*)$ [OR]
RewriteRule ^.*$ - [L]

Once I reloaded, the site worked, as expected!