CMS Integration with Existing Sites in IIS

    For this setup you will need IIS 8.0 or higher because of the URL rewrites module. In my process of figuring this out I ran into some pretty funny infinite loops so watch out those if you're site is taking a long time to load. Most of this process is just using the URL rewrites, and what we are trying to do is make our application the homepage and have the CMS rest in the back making all links needed point to it. We could easily reverse this setup and make the CMS the homepage, or we could pull data from the CMS into our web application. Making some kind of widget built based on the CMS, which is easy to do if your CMS has an API  service already built out.
   In this example I make the CMS seat behind my web application and routed the CMS's to a subdomain. There is also a legacy site which will seat next to the CMS on its own sub subdomain. If the url's within each application are relative then there is no need to modify them for this setup.

Example of URL Rewrites

To better explain this setup and if you were to think of it in another way, might look something like...
  • Main Asp.net Mvc Applicatin - url: " /"
    • CMS Site - url: "/0/*"
    • Legacy Site - url: "/1/*"
Now for the regular expressions it might look something like...

  • Pattern for Root Site - "^$"
  • Pattern for Second Site - "0/$|"^0$|^0/Default.aspx*"
  • Pattern for Third Site - "1/$|^1$|^1/Home$"

Example Setup

     The key here is the regular expressions used and the URL rewrite module which does most of the work. I simply used numbers for the subdomain. I would recommend a little something more meaning if this is going to be your setup. I probably missed a few points in my explanation however I do know that I could repeat if I need to and it's more important to know this kinda of setup is possible. 

Resources
Scott Forsyth's Blog - IIS URL Rewrite – Hosting multiple domains under one site

Popular posts from this blog

Nginx Best Practices Extended

Installing Windows on Acer chromebook 15 cb3-532

Entity Framework: ToListAynsc & WhereAsync