6 Replies Latest reply on Feb 19, 2014 10:42 AM by kurianeo

    404 and 301 mapping with IIS

    kurianeo

      Hello All,

       

      I am very new to Coldfusion and hosting coldfusion based sites in IIS.

       

      Recently I was trying to host 2 sites whose homepage is working fine. But the links are not functional. When spoke to the developer, as per him, there needs to be a mapping for 301 and 404 errors in IIS.

       

      I did set a 404 error page in IIS console, with the cfm script he asked to set (/404index.cfm) as Execute URL.

       

      But it is giving me a blank page. If this is not set, then it gives me 404 error with coldfusion stack trace.

       

      Coldfusion is updated to the latest patch 11.

       

      I am getting clueless on this. Can someone suggest a solution?

       

      Thanks in advance.

       

      Regards,

      Kurian.

        • 1. Re: 404 and 301 mapping with IIS
          Aegis Kleais Level 3

          This shouldn't be a ColdFusion-related issue if I'm understanding you correctly.

           

          All error mappings in IIS are defined in the ERROR PAGES module of IIS.

           

          You can define a 404 there, but I don't believe you can speciy 3XX series "errors".  300 errors are "Redirection" codes (an error didn't necessarily occur, however the client must take an additional step to complete the request.).  For example, if you request a page that has been cached, the server/client determines this and returns a '304 Not Modified', but it isn't an error that IIS is going to concern itself with.  So his request to add a 301 (Moved Permanetly) is better handled programmatically along with the forward to the resource's updated location.

           

          As for the 404, the path you enter is relative the the site root.  So in the user's root, is there a '404index.cfm' file?

          • 2. Re: 404 and 301 mapping with IIS
            kurianeo Level 1

            Hello Aegis,


            Thank you for the reply.

             

            /404index.cfm does exists in the website root folder.

             

            When accessing the URL, http://www.websitename.com/404index.cfm directly it does work.


            But when I put this URL (only /404index.cfm) in 404 error pages section and execute a 404 URL like http://www.website.com/hello.cfm, it gives me a blank page. This is the same case for any .cfm file that is mentioned in 404 error page section of IIS. I created a test cfm file just to see if there is any coding issue with 404index.cfm.

             

            Any ideas?

             

            Regards,

            Kurian.

            • 3. Re: 404 and 301 mapping with IIS
              Aegis Kleais Level 3

              In IIS, what is the ERROR PAGES feature set to?

               

              It should be:

               

              "Detailed Errors for Local Requests and Custom Error Pages for Remote Requests"

              • 4. Re: 404 and 301 mapping with IIS
                kurianeo Level 1

                Hello Aegis,

                 

                When "Detailed Errors for Local Requests and Custom Error Pages for Remote Requests" is set, it gives me 404 page with Missing template coldfusion stacktrace.

                 

                It gives me blank page when I choose CustomErrors.

                 

                Regards,

                Kurian.

                • 5. Re: 404 and 301 mapping with IIS
                  Anit_Kumar Adobe Employee

                  Hi Kurian,

                   

                  You can Go to Server Settings>>Settings>> Missing Template Handler and setup the same.

                   

                  To use the missing template handler with IIS, the Custom Error page of your website must be configured to use the page. For this example, we'll assume a directory name of /errorpages and a file named missingtemplate.cfm. Therefore, the path to the missing template handler will be /errorpages/missingtemplate.cfm.

                   

                  The steps below explain how to configure IIS to use the template for the Custom Error page:

                  1.          Right-click on the website in the IIS Management Console, then select Properties.

                  2.          Select the Custom Errors tab.

                  3.          Select the 404 in the HTTP Error column and click Edit Properties...

                  4.          Select URL from the Message type dropdown and enter /errors/missingtemplate.cfm in the URL text box.

                  5.          Click OK.

                  6.          Right-click on the website again and select Properties.

                  7.          Select the Home Directory tab and click the Configuration... button.

                  8.          Select .cfm from the list and click the Edit button.

                  9.          Check the "Check that file exists" checkbox.

                  10.          Restart IIS and the ColdFusion Server.

                   

                  Regards,

                  Anit Kumar

                  • 6. Re: 404 and 301 mapping with IIS
                    kurianeo Level 1

                    Hello Anit,

                     

                    Thank you for the reply.

                     

                    I did this in IIS 5.1 with WinXP and it worked. The same I tried in a win 2003 server with IIS 6 and it didn't.


                    Seems so weird and I am trying to figure out why.

                     

                    Regards,

                    Kurian.