Redirecting a site from non-www to www is pretty straight forward using .htaccess, but not so much when you are on a Windows box. The approach usually taken invloves pasting code (below rewrite engine on)  in the .htaccess file and uploading to the server in the root.

RewriteCond %{HTTP_HOST} ^yoursite.com

[NC] RewriteRule ^(.*)$ https://www.yoursite.com/$1 [L,R=301]

The steps for IIS redirect is a different story, and most the time you do not have access to do this.

  1. Go to IIS on the server and right click / select properties on the domain you want to do this for
  2. On the Web Site tab (the one already selected), clicked Advanced next to IP Address
  3. Under “Multiple Identities for this website”, if there’s a record there without “www” (e.g. yourdomain.com), select it and remove it.
  4. Click OK, Apply (to close these windows)
  5. Now add a new website to IIS by right-clicking on “Web Sites” > New > Website
  6. Call the description something meaningful like “yourdomain.com redirect”. Click Next.
  7. In the “Host header for this Web site”, enter your domain name WITHOUT www – e.g. yourdomain.com
  8. Select a path for the website. It’s best to point this domain to an empty folder (just make one up) somewhere on your server (as this domain isn’t going to be used to host anything).
  9. With this new website added, right click on it in IIS and select Properties, and select Home Directory
  10. Now click on the radio button next to “A redirection to a URL”, and enter this in the textfield below :-
    https://www.yourdomain.com$S$Q (replace “yourdomain” with your actual domain name)
  11. Now tick the box next to “The exact URL entered above”, and also tick the box next to “A permanent redirection for this resource”. Click OK and Apply

 

Quite a big difference, well thanks to a handy plugin, the process is oh so simple now. With the plugin wwwRedirect by Radoslaw Kubera, once installed you can select www to non-www OR non-www to www redirect.

How Simple was that?

Need Specific Help?
Interested in a specific topic? Review the topics below to get the info, news, and tips you need!

Recent Posts