I have my folders in public_html like this,
/ – root public html for example.com [has wordpress in it]
/a/ – this has another wordpress installed and a.example.com should be pointed to this directory
/b/ – again wordpress for b.example.com
I tried this code,
RewriteEngine On
RewriteCond %{HTTP_HOST} ^a.example.com$
RewriteCond %{REQUEST_URI} !^/a/
RewriteRule (.*) /a/$1
but it doesn’t work. I use VestaCP control panel and don’t want to add site for each subdomain instead have it all under the same root directory.
I also noticed that going to a 404 page like example.com/a/somenotfoundpage will show me the 404 page of the root wordpress installation and not /a/ installation
How can it be fixed inside .htaccess ? /a/ and /b/ are both multi site installation each and / is normal installation
the url for the /a/ and /b/ are set to a.example and b.example in wordpress settings
EDIT
VestaCP is set to redirect *.example.com to example.com. (I have used it as an aliases when adding the site, and visiting a.example.com shows me example.com content without the address changing in the address bar)
In your wp-config.php file, there’s a line that says Subdomains and it’s set to ‘false’ right now. Change it to true and your site will flip over.
Now that said… You may want to consider .htaccess redirecting the old URLs to the new ones. But it should work just that easily.