How to prevent a 404 Error when creating a subdomain and using www to access it?
- by Chris
I have installed a multi-site installation of WordPress onto my domain. I then added the necessary code to the wp-config.php file and .htaccess as instructed by WordPress.
I also installed a plugin called Quick Page/Post Redirect Plugin which allowed me to place a 301 redirect onto the main domain as I only want to use the sub domain and not the main domain. Then I also added the following line of code to the wp-config.php file to redirect the main domain define( 'NOBLOGREDIRECT', 'URL Redirect Address' );
The site works fine with a redirect on the main domain and my subdomain runs fine when you type in subdomain.example.com or http://subdomain.example.com.
However when I enter www.subdomain.example.com or http://www.subdomain.example.com the following error message is returned:
Not Found
The requested URL / was not found on this server.
Apache/2.4.9 (Unix) Server at www.subdomain.domain.com Port 80
Any help with this would be much appreciated.