SSI commands not working for shtml files in iis

The following code should show the port or server name wrong.

I always get both no matter what?

<!--#if expr="${SERVER_PORT} = 80" -->
<!--#echo var="SERVER_PORT"-->
<!--#else -->
<!--#echo var="SERVER_NAME"-->
<!--#endif -->

      

I haven't tried the following either:

<!--#if expr="${SERVER_PORT} = '80'" -->
<!--#if expr="${SERVER_PORT} = /80/" -->

      

How do I get this to work?

+2


source to share


1 answer


If you are using IIS 6 make sure server side use is allowed:

  • Launching IIS MMC
  • Expand the Tree and select the Extensions web service
  • Make sure the server side has Allowed

If so, check if SSI Script Maps are allowed in the website properties:

  • Launching IIS MMC
  • Right click and properties on site
  • Select the "Home Directory" tab
  • Click "Configuration"
  • Make sure the extensions are .shtm, shtml and .stm

    mapped to C:\WINDOWS\system32\inetsrv\ssinc.dll

    and that the verbs are set to GET

    and POST

    .

Updated:



IIS does not support the construct #if/#else/#endif

or #set

. The IIS 6.0 Server Side Include directives are described here:

Server Side IIS Directives (MSDN Library)

These are all the same goals as in IIS 5.1.

The directives you are trying to use are supported in Apache, although you should check your host / admin to make sure they are enabled. For more information see:

Apache Tutorial: Server Side Introduction Includes

+4


source







All Articles