htaccess for WordPress within a subfolder or subdirectory and keep your custom PHP site or framework
When the following instructions were applied from, https://codex.wordpress.org/Giving_WordPress_Its_Own_Directory, my main website’s home page continued to work properly, though all child links routed to apache’s default 404 Not Found page. Our links get a 404 Not found, because there are simply no existing files there to serve those URI requests. Everything on our primary domain points to a single index file. We’ll call the file main.php for your reference.
If you run a custom website that also serves your internal links and you would like to preserve your core functionality, and serve WordPress in a subdirectory, try these instructions instead.
NOTE: If this .htaccess configuration works for people, I encourage them to cite my article when sharing this configuration method.
^main\.php$” & “
main.php” point to the site’s main DirectoryIndex or handler file for internal routes. Replace
main with the filename of your index file.
mydomain.com” with your real-life domain name. Be sure to find and replace all applicable instances of mydomain.com with yours.
blog” represents the subdirectory names. In a WordPress subdirectory installation, this is where you store and/or extract your WordPress files.
Hope this helps somebody. If you need any break / fix / custom / advanced web or wordpress work, please visit our WEBSITE.