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/ 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:

 <%Dim FName'determine if this include file is trying to be directly accessed FName = Request.ServerVariables("PATH_INFO")'since the "include" directory is part of the path, someone is accessing the file directlyif InStr(FName, "include/pr") > 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.

Share the Post:
Heading photo, Metadata.

What is Metadata?

What is metadata? Well, It’s an odd concept to wrap your head around. Metadata is essentially the secondary layer of data that tracks details about the “regular” data. The regular

XDR solutions

The Benefits of Using XDR Solutions

Cybercriminals constantly adapt their strategies, developing newer, more powerful, and intelligent ways to attack your network. Since security professionals must innovate as well, more conventional endpoint detection solutions have evolved

AI is revolutionizing fraud detection

How AI is Revolutionizing Fraud Detection

Artificial intelligence – commonly known as AI – means a form of technology with multiple uses. As a result, it has become extremely valuable to a number of businesses across

AI innovation

Companies Leading AI Innovation in 2023

Artificial intelligence (AI) has been transforming industries and revolutionizing business operations. AI’s potential to enhance efficiency and productivity has become crucial to many businesses. As we move into 2023, several

data fivetran pricing

Fivetran Pricing Explained

One of the biggest trends of the 21st century is the massive surge in analytics. Analytics is the process of utilizing data to drive future decision-making. With so much of