Rewriting dynamic pages as static ones
To turn dynamic Web pages into static-looking, keyword-rich pages you need the help of your Web server. Generating the static pages as independent files is not feasible. It would require too much time and processing power, and things like inventory levels would not be updated in real-time.
Instead, what many Web sites do these days is to rely on “re-write” techniques to take a dynamic URL and turn into a static one, often using things like a product or category name as part of the page name. Unlike with the Apache Web server, there is no re-write capability built into a Windows Web server for Web sites that use Active Server Pages.
As a workaround, you have two options:
- Use re-write software such as http://www.helicontech.com/isapi_rewrite/.
- Use a custom 404 error handler, as described below
Creating static store pages using a Custom 404 Error Handler
We believe that we have found a technique that will allow you to improve your search engine rankings, is easy to implement, does not require third-party software, does not require substantial code changes, and does not violate any Webmaster “best practices” (which is a crucial concern for us).
Using a custom 404 error handler - especially created for ProductCart-powered stores - your Web server will rewrite the URL of dynamic pages so that they look and behave like static .htm pages. If you are using ProductCart v3, the page URLs will also include the product and category names, thus becoming even more search engine friendly. There are many ProductCart stores that use this technique, including the ProductCart software store.
The ASP pages are presented to the browser as ”.htm” pages. These ”.htm” pages actually don't exist on the server. The user is “transferred” from the missing .htm page to the asp page “behind the scene” using a technique that takes advantage of the custom 404 error page.
We have done extensive research and believe that this technique does not violate any “best practices” because the custom 404 error handler will correctly report that a page does not exist (404 server response code), except for properly formatted product and category links (and these pages do exist, although they are ASP pages). There is a bit of extra server processing that happens when the URL is interpreted (the product or category ID are extracted from the URL). However, the amount of server processing should be negligible and have no effect on your store.
The instructions listed below and the accompanying files are provided “as is”. We do not offer technical support on the implementation of these changes to your ProductCart-powered store. In addition, while we have done extensive research on this technique and made every effort to ensure that it does not violate any best practices recommended by search engines such as Google & Yahoo!, we cannot make any promises regarding search engine placement for your particular site, or that search engine criteria will not change at some point in the future. You assume all risk and reward for implementing this technique on your own site.
Review '/pc/inc_headerV5.asp'This file should not need to be edited, but if SEO-URLs are not working correctly, then you should verify that the file contains the reference to ProductCart's dynamic meta tag generator (pc/include-metatags.asp). To make sure that this is the case, open the file in any editor (e.g. Notepad) and make sure that it contains the following lines of code towards the top of the page:
<!--#include file="include-metatags.asp"--> <html> <head> <%if pcv_PageName<>"" then%> <title><%=pcv_PageName%></title> <%end if%> <%GenerateMetaTags()%> <%Response.Buffer=True%>
If this is not the case, you will need to edit 'inc_headerV5.asp' so that it uses the dynamic meta tag generator.
Once you have “prepared the server” (next step), turn the feature on in the ProductCart Control Panel under Settings > Store Settings > Miscellaneous. ProductCart will not allow you to turn the feature on until you have properly configured the server.
Prepare your web serverShared hosting or managed hosting
Your Web hosting account must allow you to:
- Specify a custom 404 page
- Specify that the 404 error is handled by a URL vs. a file. This is the Message Type property in IIS. If you don’t see this setting in your Web hosting account’s administration area, try performing the following steps anyway: in some scenarios this setting is detected automatically, according to our research.
- Enter the full physical path to the file
If you have access to your own server:
- IIS 6
- Start IIS (Internet Information Services) from the Administrative Tools icon in the Windows Control Panel
- Right-click on the Web site, and select Properties
- On the Properties Window, click on the Custom Errors tab, scroll down to the 404 error, select it and click on Edit Properties.
- On the dialog box that is displayed, change the Message Type to URL and enter the absolute path to the file 404.asp, which is located in the productcart/pc folder. For example: ”/store/pc/404.asp” (here the “productcart” folder has been renamed “store” and is located in the Web site root).
- Click Apply, then OK.
- IIS 7 and 7.5
- Start IIS and load your Web site
- Now left-click on the folder and click on “Error Pages” in the Web store home
- Select “Open Feature” in the right column
- Double-click on “404”
- Check the radio button “Execute URL on this site”
- As the URL, enter “/store/pc/404.asp” (here the “productcart” folder has been renamed “store” and is located in the Web site root).
- Click OK
- Finally, you need to change the default setting “Send Errors to browser” for Classic ASP from: “False” to: “True”.
At Rackspace, you will need to use a “web.config” file to accomplish this. Your “web.config” should contain the following:
<configuration> <system.webServer> <httpErrors errorMode="DetailedLocalOnly"> <remove statusCode="404" subStatusCode="-1" /> <error statusCode="404" prefixLanguageFilePath="" path="/productcart/pc/404.asp" responseMode="ExecuteURL" /> </httpErrors> </system.webServer> </configuration>
Multiple stores on the same domain
If you have multiple ProductCart-powered stores running on the same domain, you can still use the Keyword-rich URLs, but you must remember that the error handler must be specified separately for each store. Otherwise, it will not work properly (it will also point back to pages that are hosted within the first of the stores that you setup). Here is what you need to do:
- Make each sub-folder that is hosting a ProductCart-powered store an “application”. This may or may not be possible if you are in a shared hosting environment (inquire with your Web host). If you are using a dedicated server:
- Open IIS and locate the folder that is hosting the ProductCart-powered store
- IIS 7: Right click on the folder and select “Convert To Application”. Click OK.
- IIS 6: Right click on the folder and select “Properties”. Select the Directory tab. Under Applications settings, click on Create.
- Set the 404 Error handler for the new application that you have created (same steps as the ones described above). Make sure that you point it to 404.asp in the ”pc” folder of the store hosted in the folder that you just converted into an application.
InstallationThere is nothing to install as this feature is “built in”. You just need to turn it on and configure it properly. To do so, log into your Control Panel and follow these steps:
- Select Settings > Store Settings > Miscellaneous
- Set Use Keyword-rich URLs to “Yes”. Please note:
- ProductCart will not allow you to turn the feature on until you have properly configured the server to support this feature (see section above on how to prepare the Web server).
- We have heard of cases in which ProductCart was not able to successfully determine whether the server could support the feature. That is: the server was properly setup, yet ProductCart would fail to detect it. In this scenario, if you have the ability to do so, convert the folder that contains the ProductCart-powered store into an application (see above under “Prepare your Web server”) or ask your Web hosting company to do so for you. That should fix the problem.
If you are unable to do so, you can get around the issue by making a small code edit to the file “AdminSettings.asp” located in the Control Panel folder to get around the issue.
- Download the file and make a backup copy of it.
- Open it in Notepad or your favorite HTML editor.
- Locate the code:
Set xml = Nothing If strStatus="200" then %>
- Replace it with:
Set xml = Nothing strStatus="200" If strStatus="200" then %>
- Save the file and upload it back to the Control Panel folder.
- Enter the physical path to your custom error page. For example: ”/myErrorPage.html” (in this example the page is an html file called “myErrorPage.html” and located in the root of the Web site). If you don't have a custom error page, it's a good idea to create a friendly custom error page. It can just be a simple HTML file with some links to useful sections of your Web site (e.g. a link to the site map).
- Default Meta Tags
Remember that you must replace your current version of the meta tag generator (pc/include-metatags.asp) with the one included with the ProductCart_SEO files. Make sure to replace the default meta tags with your own, or use file synchronization software to simply synchronize your version of the file with the new one (applies to versions prior to v4.0).
- Updating ProductCart
If you are using an earlier version of ProductCart and/or you have customized the pages that are included with this document, compare the two files using file comparison software. The code changes used by this technique are quite small.
- Control Panel features
The Generate Links, Generate Store Map, Generate Sitemaps, Generate Google Base File, and Generate Yahoo! File features have been edited so that they generate correct links to the static store pages.
- Content Pages
If your header.asp uses the logic that generates a listing of the content pages, this article will allow you to alter that logic to provide SEO-friendly URLs for viewcontent.asp.