Server Side Includes for HTML in IIS7
By default in .html and .htm files #include virtual does not work in IIS7. I was unable to find the answer quickly on google so I figured I should document it here.
Enable Server Side Includes for IIS7
Control Panel > Programs and Features > Turn Windows Features On or Off to add the component


Now open IIS7 and in features view go to Handler Mappings

Under actions select "Add Module Mapping"

Enter the following information:
Request Path: *.html
Module: ServerSideIncludeModule
Executable: blank
Name: SSI-html
Click Ok and now your includes should function properly.
| Print article | This entry was posted by Mikeal on 08/05/08 at 09:28:37 am . Follow any responses to this post through RSS 2.0. |
11/30/10 @ 11:58:01 pm
Thanks man, solved my problem!
12/01/10 @ 03:19:32 pm
Can't thank you enough! As you, was looking all over the place for this bit of information.
12/30/10 @ 08:46:44 am
Thanks for this.
02/18/11 @ 11:32:11 am
I have the same problem calling #include virtual from a .asp file.
I tried your method above but it gives "Error processing SSI file" and then dumps the included file on the screen.
Any ideas ?
Thanks
02/25/11 @ 01:38:10 am
Thanks - great post - and I searched for HOURS to find it.
thanks again - it shouldn't be this hard. WHat's really pathetic is how unhelpful MSDN is for this issue.
03/16/11 @ 11:07:40 pm
Thanks! Solved my problem!
03/18/11 @ 01:27:06 am
In reponse to DaveR and the "Error processing SSI file" message. I had the exact same problem after adding the module mapping. I had to fix the path to my includes in the index.html file.
Perhaps that is your issue as well; worth a look.
03/28/11 @ 12:12:14 pm
Tried this and it doesn't work. This post seems to suggest it's no longer supported:
http://community.discountasp.net/showthread.php?t=9030
03/30/11 @ 11:34:33 pm
Chris I just did this successfully on 2008R2. Are you sure the feature is installed?
04/07/11 @ 11:45:45 am
I struggled to follow these steps: there are some instructions missing. THe blog should read:
Enable Server Side Includes for IIS7
Control Panel > Programs and Features > Turn Windows Features On or Off to add the component
(picture of control panel)
EXPAND THE ROLES NODE AND CLICK ON THE CLICK ON THE WEB SERVER(IIS) NODE. sCROLL DOWN TO FEATURES PANEL, AND CHECK WHETHER SERVER SIDE INCLUDES IS INSTALLED
(picture of web server features panel, which is different to the windows features panel -> source of confusion without that help advice above)
Now open IIS7 and in features view go to Handler Mappings...
04/07/11 @ 12:13:22 pm
sorry, i meant "SCROLL DOWN TO THE ROLE SERVICES PANEL.. iF SSI IS NOT INSTALLED, CLICK ADD ROLE SERVICES, AND INSTALL IT"
:)
05/10/11 @ 11:47:06 am
Worked like a charm. Thanks!
05/17/11 @ 03:58:08 pm
Perfect!
Cheers dude!
06/24/11 @ 01:10:44 pm
Thanks!!
09/27/11 @ 07:43:39 pm
This works but my module mapping keeps disappearing every 2 minutes. How to fix that? Please help
09/27/11 @ 08:58:32 pm
Fixed it, it was a batch job that kept deleting web.config and reverting the changes. Great post Mikeal, things are working perfectly.
11/09/11 @ 06:57:23 pm
Wow, this totally solved my problem. Thank you so very much!
12/02/11 @ 09:36:46 am
Thank you very much!!!
12/07/11 @ 05:31:53 pm
There were a few steps missing for installing this on Windows 2008, R2. Here are the steps which worked for me:
a. Go to ‘Start’, ‘Administrative Tools’, and click ‘Server Manager.’
b. In the ‘Server Manger’ hierarchy pane, expand ‘Roles’, and then click ‘Web Server (IIS)’.
c. In the ‘Web Server (IIS)’ pane, scroll to the ‘Role Services’ section, and then click ‘Add Role Services’.
d. On the ‘Select Role Services’ page, select ‘Server Side Includes’, and then click ‘Next’.
e. On the ‘Confirm Installation Selections’ page, click ‘Install.’
f. On the ‘Results’ page, click ‘Close.’
g. On the left hand side panel of ‘Server Manager’, expand: Roles > Web Server (IIS) > Internet Information Services (IIS) Manager.
h. In the ‘Connections’ section, expand your computer name and click on your computer name. Single-click on ‘Handler Mappings.’
i. In the ‘Actions’ section, click on ‘Open Feature’ and then click on ‘Add Module Mapping’
j. Enter the following information:
Request Path: *.html
Module: ServerSideIncludeModule
Exclude (optional): leave it blank
Name: SSI-html
k. Click ‘ok.’