WordPress Multisite WWW-redirect
During the set-up of my new site configuration I stumbled upon an issue that prevented my from visiting my root domain without using the “www” prefix. This bothered me as I never use this prefix manually. After some googling around I found a quick and simple solution that automatically redirects the user to the www-prefixed domain.
In the “.htaccess” file in your root folder add the following code segment at the start of your file above the part you replaced in the WordPress MultiSite installation:
1 2 3 4 5 6 |
# Fix www redirect <ifmodule mod_rewrite.c> RewriteEngine On RewriteCond %{HTTP_HOST} ^domain\.com$ [NC] RewriteRule ^(.*)$ http://www.domain.com/$1 [R=301,L] RewriteBase / |
Replace “domain.com” with your domain (e.g. triplustutorials.be). Your root domain is now accessabel without the www prefix! Thanks to this post for the clarification.