1

We keep getting 404s on our domain when it is example.com but not www.example.com.

I tried to redirect using the IIS rules with URL Rewrite but it throws an error for www.example.com as well. The browser won't even show the error. Any ideas on how to figure out what is going on? Thanks!

  • Is this for all requests to http://domain.com -- including subpages? – TZHX Mar 11 '15 at 13:23
  • Have you looked in the server's error log? – Stephen Ostermiller Mar 12 '15 at 14:57
2

At times IIS 7.x needs to accept the domain before it can process your web.config file.

From your IIS Manager (Internet Information Services Manager) Click on your website. To the right in the Action column find "Edit Site" below that you'll see Bindings.

In Bindings > you will see "Type" , "Hostname", "Port", "IP Address", "Binding Information".

You will see your http, domain.ext, 80, 10.0.0.1, Information.

Add another entry: http, www.domain.ext, 80, 10.0.0.1, information.

To force good SEO you can create your redirect rules to redirect domain.com to www.domain.com. Be sure to add or remove the trailing slash as well if do not redirect to a static page.

  • Not sure what you were seeing in previous versions - if you explicitly set a domain and removed the default (domainless) binding, you always had to explicitly set both www. and non www. versions in IIS. – Zhaph - Ben Duguid Mar 13 '15 at 17:15
  • @Zhaph-BenDuguid I think you're right, was trying to remember the settings in my old IIS NT 4.0 which was a long time ago. Thanks, I've updated the answer by removing that line. – Murray W Mar 13 '15 at 17:29
  • Since the OP states they reach a 404 page that gives me the impression that the DNS is routing to the IIS Server. – Murray W Mar 13 '15 at 17:35
  • True - but they don't state that they are their 404 error pages ;) If the OP's seeing the correct 404's then there is an issue with the routing on their site (which is a different issue) rather than an issue with the bindings - if the 404's are coming from their site then the bindings must be correct. – Zhaph - Ben Duguid Mar 13 '15 at 17:53
  • @DigitalAce7, using a third party to redirect isn't a fix it's called a workaround. You're basically routing your Domain to a person that actually setup the www. *. and domain.ext properly then routes it back to you. I do not advise this type of workaround if you are hosting your own IIS services. You could use this if you are using IIS on a community server (hosting service) and they do not offer proper DNS configurations. I would really like to see you setup your DNS and your IIS properly so you are not dependent on to many other services. – Murray W Mar 30 '15 at 16:41
0

Does your domain have an A record for both example.com and www.example.com?

There are a number of free online tools that will show you the DNS records for your domain.

After that, as Murray states, you need to ensure that your site in IIS has bindings for both versions of the domain if you're not using the default domainless binding.

0

I solved it by using the naked domain redirect page. http://wwwizer.com/naked-domain-redirect Worked like a charm.

  • Hmm, I wish you luck with that, you have no guarantee that that service will stick around as you're not paying for it :-( You'd be better off talking to your hosting provider and asking them if they support domains without the www. and if not consider switching to one who does. – Zhaph - Ben Duguid Mar 31 '15 at 6:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.