devxlogo

Include Files Directly Referenced by User or Search

Include Files Directly Referenced by User or Search

Often times you may have include files on your Web site that store textual information whose content varies, but that are shown in a layout that remains constant (for example, a template page). An example is press releases–you need to show the text for the press release, but otherwise the page looks the same from item to item. You also don’t want to store press release text in a database because you want it found by your search engine. However, this same search engine may find the include file and present it to the user as a viable file to “link” to as part of the search results (include/pr_bignews.inc). You don’t want them to link to the include file, so how do you get around it? In a Microsoft Internet Information Server (IIS) / Index Server setup the answer is enable the .inc file extension for your Web site, and associate it with the ASP dll, just like an Active Server Page. To do this, go into the IIS manager, and view your Default Web site properties. On the Home Directory tab, selecting the Configuration button allows you to set up application mappings. If you add the “.inc” extension to behave just like “.asp” files, the include files will be processed like an Active Server page allowing you to put code in them to redirect the user to the proper page. This method also allows you to put server-side scripting in a textual include file without affecting the presentation to the user. An example to redirect to the proper “press release” template follows:

  0 then	FName = "pr_" & Replace(Mid(FName, InStr(FName, "include/") + 11, 99),".inc","")	Response.redirect "/pr_list.asp?ID=" & FNameend if%>

The server script redirects users to the pr_list.asp page, with the parameter that will allow them to show the press release in its proper context.

devxblackblue

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist