{"id":3490,"date":"2018-09-26T06:10:08","date_gmt":"2018-09-26T06:10:08","guid":{"rendered":"https:\/\/www.gmass.co\/blog\/?p=3490"},"modified":"2020-03-17T13:17:05","modified_gmt":"2020-03-17T13:17:05","slug":"wordpress-pages-and-asp-net-mvc-same-iis-folder","status":"publish","type":"post","link":"https:\/\/www.gmass.co\/blog\/wordpress-pages-and-asp-net-mvc-same-iis-folder\/","title":{"rendered":"How to serve WordPress pages and ASP.NET MVC pages from the same IIS folder"},"content":{"rendered":"<p>I have a problem.<\/p>\n<p>I coded a bunch of landing pages as <strong>ASP.NET\u00a0MVC Views<\/strong> as part of the GMass website, and now I want to <strong>convert those landing pages to WordPress<\/strong> so that they can be more easily managed, and so I can easily create more of them.<\/p>\n<p>The landing pages are at URLs like:<\/p>\n<p><a href=\"https:\/\/www.gmass.co\/gmail-mail-merge\">https:\/\/www.gmass.co\/gmail-mail-merge<\/a><\/p>\n<p><a href=\"https:\/\/www.gmass.co\/email-outreach\">https:\/\/www.gmass.co\/email-outreach<\/a><\/p>\n<p>but I also have MVC pages at the same root level like <a href=\"https:\/\/www.gmass.co\/pricing\">https:\/\/www.gmass.co\/pricing<\/a> that I <strong>do NOT want to convert to WordPress<\/strong> that <strong>should remain functional as .NET pages<\/strong>.<\/p>\n<p>So I want to <strong>convert the existing MVC landing pages to WordPress<\/strong> and <strong>keep the URLs the same for SEO purposes<\/strong>.<\/p>\n<p>Here is how I accomplished that.<\/p>\n<h3>Step 1: Copy WordPress files to root folder of IIS site<\/h3>\n<p>The root folder of my IIS website looks as you would expect:<\/p>\n<figure id=\"attachment_3556\" aria-describedby=\"caption-attachment-3556\" style=\"width: 1125px\" class=\"wp-caption alignnone\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-3556 size-full\" src=\"https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2018\/09\/GMass-www-root-folder-web.gif\" alt=\"\" width=\"1125\" height=\"651\" \/><figcaption id=\"caption-attachment-3556\" class=\"wp-caption-text\">The root GMass folder on my IIS web server<\/figcaption><\/figure>\n<p>I installed WordPress at the same root level, which crowds the files and folders, but otherwise doesn&#8217;t do any harm. I&#8217;m assuming that PHP is already installed on\u00a0your IIS server. If not, here&#8217;s how to <a href=\"https:\/\/tekeye.uk\/windows\/install-php-on-windows\">install PHP on IIS<\/a>.<\/p>\n<figure id=\"attachment_3557\" aria-describedby=\"caption-attachment-3557\" style=\"width: 2256px\" class=\"wp-caption alignnone\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-3557 size-full\" src=\"https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2018\/09\/GMass-www-root-folder-WordPress-web.gif\" alt=\"\" width=\"2256\" height=\"2024\" \/><figcaption id=\"caption-attachment-3557\" class=\"wp-caption-text\">The root\u00a0GMass folder on my IIS web server, after I install WordPress<\/figcaption><\/figure>\n<p>Note that I also have WordPress installed in the <strong>\/blog<\/strong> folder, and the GMass blog is driven entirely by WordPress, but in the <strong>\/blog<\/strong> folder, <em>everything<\/em> is served by WordPress, so there aren&#8217;t the complexities of the setup here, which involves <strong>serving some\u00a0pages with .NET and some\u00a0pages with WordPress<\/strong>.<\/p>\n<p>So, I have <strong>two installations of WordPress<\/strong> connected to <strong>two different MySQL databases<\/strong>&#8212;<strong>one in the root GMass folder<\/strong> and <strong>one in the gmass.co\/blog folder<\/strong>.<\/p>\n<p>There is a way to <a href=\"https:\/\/www.wpbeginner.com\/wp-tutorials\/how-to-install-and-setup-wordpress-multisite-network\/\">have one installation drive TWO WordPress sites<\/a>, but I didn&#8217;t want to bother with that.<\/p>\n<h3>Step 2: Create a new MySQL database just for the landing pages<\/h3>\n<p>Create the new database to store the landing pages in MySQL using <strong>MySQL Workbench<\/strong>.<\/p>\n<p>Open up <strong>wp_config.php<\/strong>, and\u00a0replace the sample information with the actual database credentials. I will call my new MySQL database &#8220;<strong>GMassLandingPages<\/strong>&#8220;. Of course, you could use an existing MySQL database, like the one for your WordPress blog that\u00a0already has the WordPress table definitions, but I like to keep things clean and organized, so I&#8217;m creating a separate database just for my landing pages.<\/p>\n<figure id=\"attachment_3559\" aria-describedby=\"caption-attachment-3559\" style=\"width: 1428px\" class=\"wp-caption alignnone\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-3559 size-full\" src=\"https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2018\/09\/Landing-Pages-wp-config-web.png\" alt=\"\" width=\"1428\" height=\"674\" srcset=\"https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2018\/09\/Landing-Pages-wp-config-web.png 1428w, https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2018\/09\/Landing-Pages-wp-config-web-300x142.png 300w, https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2018\/09\/Landing-Pages-wp-config-web-768x362.png 768w, https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2018\/09\/Landing-Pages-wp-config-web-1024x483.png 1024w\" sizes=\"auto, (max-width: 1428px) 100vw, 1428px\" \/><figcaption id=\"caption-attachment-3559\" class=\"wp-caption-text\">My wp-config.php file, which uses my new &#8220;GMassLandingPages&#8221; database.<\/figcaption><\/figure>\n<p>Next, I have to go to <strong>https:\/\/www.gmass.co\/wp-admin<\/strong> to complete the setup of my new WordPress installation. The setup will have me create my <strong>WordPress Administrator login<\/strong>, and it will set up the <strong>GMassLandingPages<\/strong> database that I just created. Meaning, it will <strong>create the necessary tables<\/strong> and other MySQL metadata needed for the database to function as my WordPress database.<\/p>\n<h3>Step 3: Create\u00a0a WordPress page<\/h3>\n<p>Now, we&#8217;re ready to create a test page in WordPress that should be accessible at the URL https:\/\/www.gmass.co\/landing-gmail-mail-merge<\/p>\n<figure id=\"attachment_3560\" aria-describedby=\"caption-attachment-3560\" style=\"width: 3588px\" class=\"wp-caption alignnone\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-3560 size-full\" src=\"https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2018\/09\/GMass-Landing-Pages-WordPress-PageSetupURL-web.png\" alt=\"\" width=\"3588\" height=\"2694\" srcset=\"https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2018\/09\/GMass-Landing-Pages-WordPress-PageSetupURL-web.png 3588w, https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2018\/09\/GMass-Landing-Pages-WordPress-PageSetupURL-web-300x225.png 300w, https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2018\/09\/GMass-Landing-Pages-WordPress-PageSetupURL-web-768x577.png 768w, https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2018\/09\/GMass-Landing-Pages-WordPress-PageSetupURL-web-1024x769.png 1024w\" sizes=\"auto, (max-width: 3588px) 100vw, 3588px\" \/><figcaption id=\"caption-attachment-3560\" class=\"wp-caption-text\">I copy the contents of my MVC landing page into my WordPress page.<\/figcaption><\/figure>\n<p>Note that this URL is different from the original URL because I want to get it working first &#8212; then I&#8217;ll change it to the actual URL, without the word &#8220;landing&#8221; in it.<\/p>\n<p>I set it up in WordPress, and navigate to the URL <a href=\"https:\/\/www.gmass.co\/landing-gmail-mail-merge\">https:\/\/www.gmass.co\/landing-gmail-mail-merge<\/a>.<\/p>\n<figure id=\"attachment_3561\" aria-describedby=\"caption-attachment-3561\" style=\"width: 3572px\" class=\"wp-caption alignnone\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-3561 size-full\" src=\"https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2018\/09\/GMass-Landing-Pages-Server-Error-web.png\" alt=\"\" width=\"3572\" height=\"1916\" srcset=\"https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2018\/09\/GMass-Landing-Pages-Server-Error-web.png 3572w, https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2018\/09\/GMass-Landing-Pages-Server-Error-web-300x161.png 300w, https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2018\/09\/GMass-Landing-Pages-Server-Error-web-768x412.png 768w, https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2018\/09\/GMass-Landing-Pages-Server-Error-web-1024x549.png 1024w\" sizes=\"auto, (max-width: 3572px) 100vw, 3572px\" \/><figcaption id=\"caption-attachment-3561\" class=\"wp-caption-text\">Navigating to the URL of the WordPress page doesn&#8217;t work, as I would expect<\/figcaption><\/figure>\n<p>Nope, doesn&#8217;t work, but that&#8217;s what I would expect. <em>How does IIS know whether PHP or .NET should serve this URL?<\/em><\/p>\n<p>The MVC Router is looking for a matching <strong>controller<\/strong> to route the request to but doesn&#8217;t find one. <em>I need to get PHP to process this request,\u00a0not MVC.<\/em><\/p>\n<p>I&#8217;ll do that by adding an <a href=\"https:\/\/docs.microsoft.com\/en-us\/iis\/extensions\/url-rewrite-module\/using-url-rewrite-module-20\">IIS URL Rewrite Rule<\/a>. If you don&#8217;t have\u00a0the IIS Rewrite module installed yet, that&#8217;s your first step. I won&#8217;t explain how to do it here, but it&#8217;s pretty easy if you Google it. <em>Hint: Use the Web Platform Installer.<\/em><\/p>\n<p>Once the module is installed, there are two ways to manage your IIS URL Rewrite Rules: do it through the\u00a0interface in IIS, or <strong>just edit the web.config file<\/strong> manually.<\/p>\n<p>I prefer editing the web.config file manually because it&#8217;s faster for me.<\/p>\n<p>Here&#8217;s what I need to add to web.config so that the https:\/\/www.gmass.co\/landing-gmail-mail-merge page works:<\/p>\n<figure id=\"attachment_3562\" aria-describedby=\"caption-attachment-3562\" style=\"width: 1756px\" class=\"wp-caption alignnone\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-3562 size-full\" src=\"https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2018\/09\/GMass-IIS-web-config-URL-Rewrite-web.png\" alt=\"\" width=\"1756\" height=\"418\" srcset=\"https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2018\/09\/GMass-IIS-web-config-URL-Rewrite-web.png 1756w, https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2018\/09\/GMass-IIS-web-config-URL-Rewrite-web-300x71.png 300w, https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2018\/09\/GMass-IIS-web-config-URL-Rewrite-web-768x183.png 768w, https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2018\/09\/GMass-IIS-web-config-URL-Rewrite-web-1024x244.png 1024w\" sizes=\"auto, (max-width: 1756px) 100vw, 1756px\" \/><figcaption id=\"caption-attachment-3562\" class=\"wp-caption-text\">Setting a URL Rewrite rule in web.config is necessary for the WordPress pages to be served.<\/figcaption><\/figure>\n<p>In English, this URL Rewrite rule says that if the URL contains the string &#8220;landing&#8221;, route the request to index.php instead of MVC. The &#8220;rewrite&#8221; to index.php is at the core of how WordPress works on IIS. Meaning, if you have your entire blog running on WordPress on IIS in a separate \/blog folder, you&#8217;ll see a similar entry in the web.config under the \/blog folder.<\/p>\n<p>Now, the setup works, but my landing pages look ugly. It doesn&#8217;t match the red background and text styles of my existing MVC page. This is where I hand-off the project to a WordPress expert who can appropriately style my landing pages to match the look of the .NET versions of the landing pages. A WordPress expert created a custom theme for my landing pages that matches the look and feel of the existing MVC landing pages.<\/p>\n<p>Great, now my test landing page is working. I can also create as many &#8220;Pages&#8221; as I want in WordPress, and as long as they contain the word &#8220;landing&#8221; in the URL, they will work.<\/p>\n<figure id=\"attachment_3564\" aria-describedby=\"caption-attachment-3564\" style=\"width: 2686px\" class=\"wp-caption alignnone\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-3564 size-full\" src=\"https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2018\/09\/GMass-Landing-Page-WordPress-web.png\" alt=\"\" width=\"2686\" height=\"2226\" srcset=\"https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2018\/09\/GMass-Landing-Page-WordPress-web.png 2686w, https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2018\/09\/GMass-Landing-Page-WordPress-web-300x249.png 300w, https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2018\/09\/GMass-Landing-Page-WordPress-web-768x636.png 768w, https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2018\/09\/GMass-Landing-Page-WordPress-web-1024x849.png 1024w\" sizes=\"auto, (max-width: 2686px) 100vw, 2686px\" \/><figcaption id=\"caption-attachment-3564\" class=\"wp-caption-text\">Now the WordPress landing page is working.<\/figcaption><\/figure>\n<p>But remember, I want to migrate my landing pages to WordPress and keep the URLs the same, so I don&#8217;t lose any SEO juice.<\/p>\n<p>I\u00a0could make things easier on myself if I decided that changing the URLs is acceptible that all my WordPress pages will have URLs containing the word &#8220;landing&#8221;. Then I can use\u00a0the one rule I added to web.config. But for now, I don&#8217;t want to do that.<\/p>\n<p>First, I&#8217;m going to <strong>edit the URL in WordPress<\/strong> and remove the &#8220;landing&#8221; portion of the URL.<\/p>\n<figure id=\"attachment_3570\" aria-describedby=\"caption-attachment-3570\" style=\"width: 2726px\" class=\"wp-caption alignnone\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-3570 size-full\" src=\"https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2018\/09\/GMass-Landing-Pages-WordPress-PageSetupURL-Final-web.png\" alt=\"\" width=\"2726\" height=\"1218\" srcset=\"https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2018\/09\/GMass-Landing-Pages-WordPress-PageSetupURL-Final-web.png 2726w, https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2018\/09\/GMass-Landing-Pages-WordPress-PageSetupURL-Final-web-300x134.png 300w, https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2018\/09\/GMass-Landing-Pages-WordPress-PageSetupURL-Final-web-768x343.png 768w, https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2018\/09\/GMass-Landing-Pages-WordPress-PageSetupURL-Final-web-1024x458.png 1024w\" sizes=\"auto, (max-width: 2726px) 100vw, 2726px\" \/><figcaption id=\"caption-attachment-3570\" class=\"wp-caption-text\">I&#8217;m removing the &#8220;landing-&#8221; portion from the Permalink in WordPress.<\/figcaption><\/figure>\n<p>Now all I have to do is add an entry in web.config for this specific page, so that it&#8217;s served by WordPress and not .NET. I&#8217;m going to remove the first rule I put in that was based on the string &#8220;landing&#8221; and replace it with this rule, that will handle this one specific landing page.<\/p>\n<figure id=\"attachment_3565\" aria-describedby=\"caption-attachment-3565\" style=\"width: 1824px\" class=\"wp-caption alignnone\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-3565 size-full\" src=\"https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2018\/09\/GMass-IIS-web-config-URL-Rewrite-Final-web.png\" alt=\"\" width=\"1824\" height=\"480\" srcset=\"https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2018\/09\/GMass-IIS-web-config-URL-Rewrite-Final-web.png 1824w, https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2018\/09\/GMass-IIS-web-config-URL-Rewrite-Final-web-300x79.png 300w, https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2018\/09\/GMass-IIS-web-config-URL-Rewrite-Final-web-768x202.png 768w, https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2018\/09\/GMass-IIS-web-config-URL-Rewrite-Final-web-1024x269.png 1024w\" sizes=\"auto, (max-width: 1824px) 100vw, 1824px\" \/><figcaption id=\"caption-attachment-3565\" class=\"wp-caption-text\">Since I want to keep the URLs of the landing pages the same in the move from MVC to WordPress, I will create a separate rule for each landing page.<\/figcaption><\/figure>\n<p>And voila! The final page, using the <strong>same URL<\/strong>,\u00a0is <strong>now being served by WordPress<\/strong> and <strong>not ASP.NET<\/strong>.<\/p>\n<figure id=\"attachment_3566\" aria-describedby=\"caption-attachment-3566\" style=\"width: 2386px\" class=\"wp-caption alignnone\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-3566 size-full\" src=\"https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2018\/09\/GMass-Landing-Page-WordPress-Final-web.png\" alt=\"\" width=\"2386\" height=\"2206\" srcset=\"https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2018\/09\/GMass-Landing-Page-WordPress-Final-web.png 2386w, https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2018\/09\/GMass-Landing-Page-WordPress-Final-web-300x277.png 300w, https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2018\/09\/GMass-Landing-Page-WordPress-Final-web-768x710.png 768w, https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2018\/09\/GMass-Landing-Page-WordPress-Final-web-1024x947.png 1024w\" sizes=\"auto, (max-width: 2386px) 100vw, 2386px\" \/><figcaption id=\"caption-attachment-3566\" class=\"wp-caption-text\">And that&#8217;s it! This page is now being served from WordPress instead of .NET MVC.<\/figcaption><\/figure>\n<p>If my landing page URLs don&#8217;t follow any specific pattern or have a string in common, then I&#8217;ll have to create a Rewrite rule for each landing page, but that&#8217;s a simple task, and the benefit of manaing my landing pages in WordPress far outweighs the inconvenience of having to add Rewrite rules to my web.config file.<\/p>\n<h3>Step 4:\u00a0Celebrate!<\/h3>\n<p>Check it out! So now, my WordPress pages work and are served by WordPress:<\/p>\n<p><a href=\"http:\/\/www.gmass.co\/gmail-mail-merge\">www.gmass.co\/gmail-mail-merge<\/a><\/p>\n<p>and my MVC pages like my <strong>Pricing page<\/strong> are still served with MVC:<\/p>\n<p><a href=\"http:\/\/www.gmass.co\/pricing\">www.gmass.co\/pricing<\/a><\/p>\n<p>and both are in the same root level folder of my IIS installation.<\/p>\n<h3>Bonus: how do you know whether MVC or WordPress is serving a particular page?<\/h3>\n<p>Everything might be working, but you might want to be certain that WordPress is serving a page and not MVC. Of course, you could make a simple edit to the page in WordPress and then just reload it in the browser, but it&#8217;s easy to tell using <strong>Chrome&#8217;s Developer Tools<\/strong>. Just right click the page, choose <strong>Inspect<\/strong>, and then navigate to the <strong>Network<\/strong> tab, and look at the <strong>Response Headers<\/strong>.<\/p>\n<figure id=\"attachment_3572\" aria-describedby=\"caption-attachment-3572\" style=\"width: 3046px\" class=\"wp-caption alignnone\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-3572\" src=\"https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2018\/09\/Chrome-Inspect-Network-MVC-web.png\" alt=\"\" width=\"3046\" height=\"2884\" srcset=\"https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2018\/09\/Chrome-Inspect-Network-MVC-web.png 3046w, https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2018\/09\/Chrome-Inspect-Network-MVC-web-300x284.png 300w, https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2018\/09\/Chrome-Inspect-Network-MVC-web-768x727.png 768w, https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2018\/09\/Chrome-Inspect-Network-MVC-web-1024x970.png 1024w\" sizes=\"auto, (max-width: 3046px) 100vw, 3046px\" \/><figcaption id=\"caption-attachment-3572\" class=\"wp-caption-text\">The original landing page, served by ASP.NET MVC.<\/figcaption><\/figure>\n<p>And here&#8217;s the new version of the page, served by WordPress:<\/p>\n<figure id=\"attachment_3573\" aria-describedby=\"caption-attachment-3573\" style=\"width: 3048px\" class=\"wp-caption alignnone\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-3573\" src=\"https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2018\/09\/Chrome-Inspect-Network-PHP-web.png\" alt=\"\" width=\"3048\" height=\"2786\" srcset=\"https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2018\/09\/Chrome-Inspect-Network-PHP-web.png 3048w, https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2018\/09\/Chrome-Inspect-Network-PHP-web-300x274.png 300w, https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2018\/09\/Chrome-Inspect-Network-PHP-web-768x702.png 768w, https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2018\/09\/Chrome-Inspect-Network-PHP-web-1024x936.png 1024w\" sizes=\"auto, (max-width: 3048px) 100vw, 3048px\" \/><figcaption id=\"caption-attachment-3573\" class=\"wp-caption-text\">The same landing page served by WordPress (PHP).<\/figcaption><\/figure>\n<p>Notice the difference in the <strong>X-Powered-By<\/strong> response header. This headers tells you whether the page was served by PHP (meaning WordPress) or by MVC.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I have a problem. I coded a bunch of landing pages as ASP.NET\u00a0MVC Views as part of the GMass website, and now I want to convert those landing\u2026<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[6539,4253,2432,4536],"tags":[],"class_list":["post-3490","post","type-post","status-publish","format-standard","hentry","category-iis","category-how-to-guides","category-sysadmins","category-wordpress"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.3 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\r\n<title>How to serve WordPress pages and ASP.NET MVC pages from the same IIS folder<\/title>\r\n<meta name=\"description\" content=\"I hand-coded my website landing pages as MVC Views, and now I want to convert those landing pages to WordPress, while keeping the URLs intact.\" \/>\r\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\r\n<link rel=\"canonical\" href=\"https:\/\/www.gmass.co\/blog\/wordpress-pages-and-asp-net-mvc-same-iis-folder\/\" \/>\r\n<meta property=\"og:locale\" content=\"en_US\" \/>\r\n<meta property=\"og:type\" content=\"article\" \/>\r\n<meta property=\"og:title\" content=\"How to serve WordPress pages and ASP.NET MVC pages from the same IIS folder\" \/>\r\n<meta property=\"og:description\" content=\"I hand-coded my website landing pages as MVC Views, and now I want to convert those landing pages to WordPress, while keeping the URLs intact.\" \/>\r\n<meta property=\"og:url\" content=\"https:\/\/www.gmass.co\/blog\/wordpress-pages-and-asp-net-mvc-same-iis-folder\/\" \/>\r\n<meta property=\"og:site_name\" content=\"GMass Blog\" \/>\r\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/GmailMailMerge\/\" \/>\r\n<meta property=\"article:published_time\" content=\"2018-09-26T06:10:08+00:00\" \/>\r\n<meta property=\"article:modified_time\" content=\"2020-03-17T13:17:05+00:00\" \/>\r\n<meta property=\"og:image\" content=\"https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2018\/09\/GMass-www-root-folder-web.gif\" \/>\r\n<meta name=\"author\" content=\"Ajay Goel\" \/>\r\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\r\n<meta name=\"twitter:creator\" content=\"@PartTimeSnob\" \/>\r\n<meta name=\"twitter:site\" content=\"@GMassForGmail\" \/>\r\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Ajay Goel\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"7 minutes\" \/>\r\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.gmass.co\\\/blog\\\/wordpress-pages-and-asp-net-mvc-same-iis-folder\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.gmass.co\\\/blog\\\/wordpress-pages-and-asp-net-mvc-same-iis-folder\\\/\"},\"author\":{\"name\":\"Ajay Goel\",\"@id\":\"https:\\\/\\\/www.gmass.co\\\/blog\\\/#\\\/schema\\\/person\\\/b5fa74f8765b860701158fd77162fff8\"},\"headline\":\"How to serve WordPress pages and ASP.NET MVC pages from the same IIS folder\",\"datePublished\":\"2018-09-26T06:10:08+00:00\",\"dateModified\":\"2020-03-17T13:17:05+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.gmass.co\\\/blog\\\/wordpress-pages-and-asp-net-mvc-same-iis-folder\\\/\"},\"wordCount\":1537,\"commentCount\":7,\"image\":{\"@id\":\"https:\\\/\\\/www.gmass.co\\\/blog\\\/wordpress-pages-and-asp-net-mvc-same-iis-folder\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.gmass.co\\\/blog\\\/wp-content\\\/uploads\\\/2018\\\/09\\\/GMass-www-root-folder-web.gif\",\"articleSection\":[\"IIS\",\"In Depth How-To Guides\",\"Sysadmins\",\"WordPress\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.gmass.co\\\/blog\\\/wordpress-pages-and-asp-net-mvc-same-iis-folder\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.gmass.co\\\/blog\\\/wordpress-pages-and-asp-net-mvc-same-iis-folder\\\/\",\"url\":\"https:\\\/\\\/www.gmass.co\\\/blog\\\/wordpress-pages-and-asp-net-mvc-same-iis-folder\\\/\",\"name\":\"How to serve WordPress pages and ASP.NET MVC pages from the same IIS folder\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.gmass.co\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.gmass.co\\\/blog\\\/wordpress-pages-and-asp-net-mvc-same-iis-folder\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.gmass.co\\\/blog\\\/wordpress-pages-and-asp-net-mvc-same-iis-folder\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.gmass.co\\\/blog\\\/wp-content\\\/uploads\\\/2018\\\/09\\\/GMass-www-root-folder-web.gif\",\"datePublished\":\"2018-09-26T06:10:08+00:00\",\"dateModified\":\"2020-03-17T13:17:05+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/www.gmass.co\\\/blog\\\/#\\\/schema\\\/person\\\/b5fa74f8765b860701158fd77162fff8\"},\"description\":\"I hand-coded my website landing pages as MVC Views, and now I want to convert those landing pages to WordPress, while keeping the URLs intact.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.gmass.co\\\/blog\\\/wordpress-pages-and-asp-net-mvc-same-iis-folder\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.gmass.co\\\/blog\\\/wordpress-pages-and-asp-net-mvc-same-iis-folder\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.gmass.co\\\/blog\\\/wordpress-pages-and-asp-net-mvc-same-iis-folder\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.gmass.co\\\/blog\\\/wp-content\\\/uploads\\\/2018\\\/09\\\/GMass-www-root-folder-web.gif\",\"contentUrl\":\"https:\\\/\\\/www.gmass.co\\\/blog\\\/wp-content\\\/uploads\\\/2018\\\/09\\\/GMass-www-root-folder-web.gif\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.gmass.co\\\/blog\\\/wordpress-pages-and-asp-net-mvc-same-iis-folder\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.gmass.co\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to serve WordPress pages and ASP.NET MVC pages from the same IIS folder\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.gmass.co\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.gmass.co\\\/blog\\\/\",\"name\":\"GMass Blog\",\"description\":\"Tips and tricks for sending mail merge and mass email campaigns directly from Gmail\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.gmass.co\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.gmass.co\\\/blog\\\/#\\\/schema\\\/person\\\/b5fa74f8765b860701158fd77162fff8\",\"name\":\"Ajay Goel\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/f3a70af05bbabe47925150d5a1320540e801b78055a74da20658fc97cd0706a2?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/f3a70af05bbabe47925150d5a1320540e801b78055a74da20658fc97cd0706a2?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/f3a70af05bbabe47925150d5a1320540e801b78055a74da20658fc97cd0706a2?s=96&d=mm&r=g\",\"caption\":\"Ajay Goel\"},\"description\":\"Ajay is the founder of GMass and has been developing email sending software for 20 years.\",\"sameAs\":[\"https:\\\/\\\/twitter.com\\\/PartTimeSnob\",\"https:\\\/\\\/x.com\\\/PartTimeSnob\"],\"url\":\"https:\\\/\\\/www.gmass.co\\\/blog\\\/author\\\/ajay-goel\\\/\"}]}<\/script>\r\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to serve WordPress pages and ASP.NET MVC pages from the same IIS folder","description":"I hand-coded my website landing pages as MVC Views, and now I want to convert those landing pages to WordPress, while keeping the URLs intact.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.gmass.co\/blog\/wordpress-pages-and-asp-net-mvc-same-iis-folder\/","og_locale":"en_US","og_type":"article","og_title":"How to serve WordPress pages and ASP.NET MVC pages from the same IIS folder","og_description":"I hand-coded my website landing pages as MVC Views, and now I want to convert those landing pages to WordPress, while keeping the URLs intact.","og_url":"https:\/\/www.gmass.co\/blog\/wordpress-pages-and-asp-net-mvc-same-iis-folder\/","og_site_name":"GMass Blog","article_publisher":"https:\/\/www.facebook.com\/GmailMailMerge\/","article_published_time":"2018-09-26T06:10:08+00:00","article_modified_time":"2020-03-17T13:17:05+00:00","og_image":[{"url":"https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2018\/09\/GMass-www-root-folder-web.gif","type":"","width":"","height":""}],"author":"Ajay Goel","twitter_card":"summary_large_image","twitter_creator":"@PartTimeSnob","twitter_site":"@GMassForGmail","twitter_misc":{"Written by":"Ajay Goel","Est. reading time":"7 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.gmass.co\/blog\/wordpress-pages-and-asp-net-mvc-same-iis-folder\/#article","isPartOf":{"@id":"https:\/\/www.gmass.co\/blog\/wordpress-pages-and-asp-net-mvc-same-iis-folder\/"},"author":{"name":"Ajay Goel","@id":"https:\/\/www.gmass.co\/blog\/#\/schema\/person\/b5fa74f8765b860701158fd77162fff8"},"headline":"How to serve WordPress pages and ASP.NET MVC pages from the same IIS folder","datePublished":"2018-09-26T06:10:08+00:00","dateModified":"2020-03-17T13:17:05+00:00","mainEntityOfPage":{"@id":"https:\/\/www.gmass.co\/blog\/wordpress-pages-and-asp-net-mvc-same-iis-folder\/"},"wordCount":1537,"commentCount":7,"image":{"@id":"https:\/\/www.gmass.co\/blog\/wordpress-pages-and-asp-net-mvc-same-iis-folder\/#primaryimage"},"thumbnailUrl":"https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2018\/09\/GMass-www-root-folder-web.gif","articleSection":["IIS","In Depth How-To Guides","Sysadmins","WordPress"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.gmass.co\/blog\/wordpress-pages-and-asp-net-mvc-same-iis-folder\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.gmass.co\/blog\/wordpress-pages-and-asp-net-mvc-same-iis-folder\/","url":"https:\/\/www.gmass.co\/blog\/wordpress-pages-and-asp-net-mvc-same-iis-folder\/","name":"How to serve WordPress pages and ASP.NET MVC pages from the same IIS folder","isPartOf":{"@id":"https:\/\/www.gmass.co\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.gmass.co\/blog\/wordpress-pages-and-asp-net-mvc-same-iis-folder\/#primaryimage"},"image":{"@id":"https:\/\/www.gmass.co\/blog\/wordpress-pages-and-asp-net-mvc-same-iis-folder\/#primaryimage"},"thumbnailUrl":"https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2018\/09\/GMass-www-root-folder-web.gif","datePublished":"2018-09-26T06:10:08+00:00","dateModified":"2020-03-17T13:17:05+00:00","author":{"@id":"https:\/\/www.gmass.co\/blog\/#\/schema\/person\/b5fa74f8765b860701158fd77162fff8"},"description":"I hand-coded my website landing pages as MVC Views, and now I want to convert those landing pages to WordPress, while keeping the URLs intact.","breadcrumb":{"@id":"https:\/\/www.gmass.co\/blog\/wordpress-pages-and-asp-net-mvc-same-iis-folder\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.gmass.co\/blog\/wordpress-pages-and-asp-net-mvc-same-iis-folder\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.gmass.co\/blog\/wordpress-pages-and-asp-net-mvc-same-iis-folder\/#primaryimage","url":"https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2018\/09\/GMass-www-root-folder-web.gif","contentUrl":"https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2018\/09\/GMass-www-root-folder-web.gif"},{"@type":"BreadcrumbList","@id":"https:\/\/www.gmass.co\/blog\/wordpress-pages-and-asp-net-mvc-same-iis-folder\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.gmass.co\/blog\/"},{"@type":"ListItem","position":2,"name":"How to serve WordPress pages and ASP.NET MVC pages from the same IIS folder"}]},{"@type":"WebSite","@id":"https:\/\/www.gmass.co\/blog\/#website","url":"https:\/\/www.gmass.co\/blog\/","name":"GMass Blog","description":"Tips and tricks for sending mail merge and mass email campaigns directly from Gmail","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.gmass.co\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.gmass.co\/blog\/#\/schema\/person\/b5fa74f8765b860701158fd77162fff8","name":"Ajay Goel","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/f3a70af05bbabe47925150d5a1320540e801b78055a74da20658fc97cd0706a2?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/f3a70af05bbabe47925150d5a1320540e801b78055a74da20658fc97cd0706a2?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/f3a70af05bbabe47925150d5a1320540e801b78055a74da20658fc97cd0706a2?s=96&d=mm&r=g","caption":"Ajay Goel"},"description":"Ajay is the founder of GMass and has been developing email sending software for 20 years.","sameAs":["https:\/\/twitter.com\/PartTimeSnob","https:\/\/x.com\/PartTimeSnob"],"url":"https:\/\/www.gmass.co\/blog\/author\/ajay-goel\/"}]}},"_links":{"self":[{"href":"https:\/\/www.gmass.co\/blog\/wp-json\/wp\/v2\/posts\/3490","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.gmass.co\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.gmass.co\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.gmass.co\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.gmass.co\/blog\/wp-json\/wp\/v2\/comments?post=3490"}],"version-history":[{"count":14,"href":"https:\/\/www.gmass.co\/blog\/wp-json\/wp\/v2\/posts\/3490\/revisions"}],"predecessor-version":[{"id":3576,"href":"https:\/\/www.gmass.co\/blog\/wp-json\/wp\/v2\/posts\/3490\/revisions\/3576"}],"wp:attachment":[{"href":"https:\/\/www.gmass.co\/blog\/wp-json\/wp\/v2\/media?parent=3490"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.gmass.co\/blog\/wp-json\/wp\/v2\/categories?post=3490"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.gmass.co\/blog\/wp-json\/wp\/v2\/tags?post=3490"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}