redirect all domain from non www


Have a Wordpress MU network with over 100 domains.
Is there a good way to redirect all domains from to

I know I can add a redirect in the htaccess.
I am looking for a global solution, that redirect every domain directly to his www.

thx for the help.

  • Arun Basil Lal
    • New Recruit

    Hello Bennos,

    Welcome to the Forum!

    If it is not critical, I would say do not go for www. WordPress Multisite strips out www from the urls, not the Domain Mapping plugin.

    Here is why:

    WWWs are only meant for the main level of a domain
    WordPress Multsite as standard doesn't support WWW so when you try to use www. with domain mapping you are trying to force WordPress to recognise WWW. This isn't recommended because it could cause all sorts of problems elsewhere.

    This would then mean that domain mapping would try to use WWW which multisite would then try to redirect to a non-WWW site which would then try to redirect to the WWW via domain mapping and would result in you getting stuck in a loop.

    But if you still insist, you can try this:

    Add this to your root .htaccess

    RewriteCond %{HTTP_HOST} !^$
    RewriteRule ^(.*)$$1 [R=301]

    Good luck!

  • omlabs
    • New Recruit

    Think there is a little missunderstanding.

    The network does not host subdomains. All Blogs are Topleveldomains like

    A global redirect from non www rule would not cause in a loop.

    Found a sloution

    RewriteEngine on
    RewriteCond %{SERVER_PORT}s ^(443(s)|[0-9]+s)$
    RewriteRule ^(.+)$ - [env=askapache:%2]
    # redirect urls with index.html to folder
    RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^/]+/)*index\.html\ HTTP/
    RewriteRule ^(([^/]+/)*)index\.html$ http%{ENV:askapache}://%{HTTP_HOST}/$1 [R=301,L]
    # change // to /
    RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /(.*)//(.*)\ HTTP/ [NC]
    RewriteRule ^.*$ http%{ENV:askapache}://%{HTTP_HOST}/%1/%2 [R=301,L]

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.