Setting up friendly URL on VP-ASP 6.50 using ISAPI_REWRITE

Setting up friendly URL on VP-ASP 6.50 using ISAPI_REWRITE

1) Install ISAPI_REWRITE 3

ISAPI_REWRITE 3 is a URL rewrite module for IIS. There are currently 2 version of this module available, Lite and Full version. The lite version is available for free with limitation. This module can be purchased or downloaded from :

http://www.helicontech.com/isapi_rewrite/

2) Edit the httpd.conf or .httaccess file.

For the lite/free version of the software, this file can be located inside the installation folder of ISAPI_REWRITE (C:\program files\helicon\ISAPI_Rewrite3). For the full version, a file called ".httaccss" file must be created and be placed at the root folder.

Paste the following code to the file and save it :

If your shopping cart is at the root folder :

RewriteEngine on

RewriteBase /

RewriteRule [^?/]*-(\d+)\.htm shopexd.asp?ID=$1 [QSA]

RewriteRule [^?/]*-c(\d+)\.htm shopdisplayproducts.asp?ID=$1 [QSA]

RewriteRule [^?/]*-cat(\d+)\.htm shopdisplaycategories.asp?ID=$1 [QSA]

If your shopping cart is in the folder "SHOPPING"

RewriteEngine on

RewriteBase /

RewriteRule shopping/[^?/]*-(\d+)\.htm shopping/shopexd.asp?ID=$1 [QSA]

RewriteRule shopping/[^?/]*-c(\d+)\.htm shopping/shopdisplayproducts.asp?ID=$1 [QSA]

RewriteRule shopping/[^?/]*-cat(\d+)\.htm shopping/shopdisplaycategories.asp?ID=$1 [QSA]

The above rule will rewrite the following URL :

  • xxxxxxxx-catalogid .htm -> shopexd.asp?ID=catalogid
  • xxxxxxxx-cCategoryId .htm-> shopdisplayproducts.asp?id=CategoryID
  • xxxxxxxx-catCategoryID .htm -> shopdisplaycategories.asp?id=CategoryID

For example :

  • Apple-Set-12.htm -> Shopexd.asp?id=12
  • Office-c1.htm -> Shopdisplayproducts.asp?id=1
  • Living-cat2.htm -> shopdisplaycategories.asp?id=2

3) Modify VP-ASP files to generate links to friendly URL.

There are currently 2 methods to tell VP-ASP to generate the friendly URL. The first method that does not require customization is to enter the friendly URL using the format above to the field "cdescurl" and also disable "xaddcatalogid"

For example:

For the product apple set with the catalog id 12, please set the "Extended Description Page" of this produc to "Apple-Set-12.htm". This field should always use the format ProductName-catalogid.htm or else the URL Rewrite engine will not work.

The disadvantage of the method above is that it will only generate the friendly URL link to the extended descrption page. Category listing page will still use the default shopdisplayproducts.asp or shopdisplaycategories.asp

For the second method, VP-SAP will automatically generate the friendly URL and also the URL of the category listing pages. This will require some customization on the files. Please open the file listed below and perform the modification per the instruction :

shopproductformat.asp

Locate the following code :

(approximately line 342 and 348)

strDescURL=strDescURL & "?id=" & lngCatalogID

Replace it with :

strDescURL=server.URLEncode(replace(strCname," ","-"))& "-" & lngcatalogid & ".htm"

shopdisplaycategories.asp

Locate the following code :

(approximately line 227 to 237)

<a href="shopdisplayproducts.asp?id=<%=id%>&cat=<%=linkname & addwebsesslink%>"> <img border="0" src="<% StrCatImage%>" alt="<%=strcategory%>"></a>

<a href="shopdisplaycategories.asp?id=<%=id%>&cat=<%=linkname & addwebsesslink %>"> <img border="0" src="<%=StrCatImage%>" alt="<%=strcategory%>"></a>

modify it to :

<a href="<%=server.URLEncode(replace(iname," ","-"))& "-c" & id & ".htm"%>"> <img border="0" src="<%=StrCatImage%>" alt="<%=strcategory%>"></a>

<a href="<%=server.URLEncode(replace(iname," ","-"))& "-cat" & id & ".htm"%>" <img border="0" src="<%=StrCatImage%>" alt="<%=strcategory%>"></a>


Times Viewed:
14599
Added By:
Frank
Date Created:
1/22/2009
Last Updated:
10/11/2011
Back Search other topics Submit a Ticket