Friendly URLs with ISAPI Rewrite |
Post Reply |
Author | |
slinc
Newbie Joined: 10-February-2007 Location: United States Status: Offline Points: 0 |
Post Options
Thanks(0)
Posted: 08-December-2007 at 4:23pm |
I posted recently that we had modified Product Cart in order to use ISAPI rewritting to make our URL's much cleaner. After getting several request as to how we did it I thought I would post a few highlights of what had to be done for the community. I am not a professional programmer so anything I have done could possibly be improved on. I HIGHLY recommend that Product Cart add this to their future versions.
The below information will convert: domain.com/category/uniquename domain.com/products/uniquename domain.com/home/uniquename into domain.com/pc/viewCategories.asp?idCategory=uniquename domain.com/pc/viewprd.asp?idproduct=uniquename domain.com/pc/viewcontent.asp?idpage=uniquename 1. Install Helicon Tech's ISAPI Rewriter program - www.helicontech.com - You will need either a dedicated server or a hosted server with some type of ISAPI rewriter installed. 2. Create some Rewrite Rules based on their instructions. If you need help use their support forum it is great. Mine are similar to this: RewriteCond %{HTTP:Host} ^(.*\.)?domain\.com$ RewriteRule ^/category/([^/.?]+)/?(?:\?(.*))?$ /pc/viewCategories.asp?idCategory=$1?2&$2: [NC,L] RewriteRule ^/products/([^/.?]+)/?(?:\?(.*))?$ /pc/viewPrd.asp\?idproduct=$1?2&$2: [NC] RewriteRule ^/home/([^/.?]+)/?(?:\?(.*))?$ /pc/viewcontent.asp?idpage=$1&$2: [NC,L] RewriteRule ^/?(?:\?(.*))?$ /pc/home.asp?idpage=&$1?2&$2: [NC,L] 3. Modify the "products", "categories" and "pccontents" database tables and add a column called something like "Unique_Name". Doesn't matter the name just so you know it. I have created a way to add custom fields pretty quickly to the control panel for editing. Assign each product, categories and content page a unique name. 4. Modify "pc/viewprd.asp", "pc/viewcategories.asp" and "pc/viewcontent.asp" and look for the main query that gets the data for the page from the database and add something link this to the query. You are basically looking up the information you need by a "Unique_Name" OR by the standard "D". WHERE (((idCategory)="&pTempIntSubCategory&")) or (((uniqueName)='"&pTempIntSubCategory&"')) 5. Now you need to change how ProductCart displays URL's on the displayed pages. I created 3 functions that did this that looks similar to this. If a "Unique_Name" is passed it will rewrite the link. If not, it will show the standard ProductCart link. You will need to go through all the ProductCart code and decide which links you want to modify. Be sure to comment well. The functions for each are similar to below (Mine is not exact as I am doing other stuff as well in the function which you want need): 'strCatName is your unique_name and str_pldCategory is the category id Function createCatlink(strCatName,str_pIdCategory) If strCatName <> "" then createCatlink="../category/" & strCatName else createCatlink="viewcategories. asp?idcategory=" & str_pIdCategory End if End Function 6. One thing that took me a while to figure out was why my Stylesheets and images stopped working. I realized that I the rewriting was changing the base path to which everything referenced. So I add this to the top of header.asp. if request("hidebase") = "" then If Request.ServerVariables ("HTTPS") = "off" then response.write "<base href='"&scStoreURL&"/pc/'>" else response.write "<base href='"&scSSLUrl&"/pc/'>" end if End if Now I am sure that I have missed something above as I did it almost a year ago. It took about 2 weeks to get it working just right. Early Impact could probably implement it much quicker since I had never seen the code before starting. I would recommend that if you are not very comfortable with programming that you don't tackle this as it may be cheaper to find a programmer or beg Early Impact to add it to a future release I believe this is the absolute best way to do URL rewriting and would highly recommend it to Product Cart for addition (Haven't I said that already:)) Hope this helps. |
|
ProductCart
Admin Group ProductCart Team Joined: 01-October-2003 Status: Offline Points: 135 |
Post Options
Thanks(0)
|
Thanks for taking the time to post this. I'm sure it will be helpful for many ProductCart users. The reason why this is not built into ProductCart is that most ProductCart-powered stores are not in a hosting environment where ISAPI rewrite can be done. Thus, the suggestion to use the 404-based technique shown elsewhere in this forum. In addition, the approach shown above is based on an assumption that is not always true: product and - especially - category names are not always unique. We see this all the time. That said, ISAPI Rewrite is a great way to go for stores that can use this technique. We invite a good developer to create an Add-on for ProductCart that ProductCart stores can use. The Add-on could include a license of HeliconTech Isapi Rewrite program, which this developer would resell as part of the packaged solution. Different versions of ProductCart could be supported. Come on ProductCart Resellers! |
|
amytxus
Newbie Joined: 09-August-2007 Status: Offline Points: 0 |
Post Options
Thanks(0)
|
I would be very interested in this add-on. Ability to have PC do SEO friendly URLs out of the box would make this cart just about perfect.
|
|
Guests
Guest |
Post Options
Thanks(0)
|
I have been doing some research on the ISAPI rewrite and actualy found something regarding a ISAPI mod from product cart. At least I think that was what I was reading when I searched for "SEO friendly URL" in this forum. We have hired on an SEO company and they want our product URL change on our website to static URL and my developer says it can not happen (or maybe it is too much of a pain)?. Can some one please enlighten me as to what I should do. I understand the importance of cleaning up the URL but can someone please point me in the right direction as who I should speak with or if you have done the ISAPI rewrite did you see the difference? Thanks for everyone input.
|
|
ProductCart
Admin Group ProductCart Team Joined: 01-October-2003 Status: Offline Points: 135 |
Post Options
Thanks(0)
|
Another ProductCart customer recently used the approach detailed in the following document, and just reported to us that his site's search engine placement has improved dramatically as a result: http://www.earlyimpact.com/forum/uploaded_files/earlyimp/200 7-11-17_175837_pcSEP_v3.11_111607.zip This approach does not require the implementation of an ISAPI rewrite component. |
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |