Using ISAPI_Rewrite to get rid of /productcart/pc/
Printed From: ProductCart E-Commerce Solutions
Category: ProductCart
Forum Name: Customizing ProductCart
Forum Description: Exchange messages with other users that are customizing ProductCart.
URL: https://forum.productcart.com/forum_posts.asp?TID=3046
Printed Date: 23-July-2025 at 10:02am Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com
Topic: Using ISAPI_Rewrite to get rid of /productcart/pc/
Posted By: Guests
Subject: Using ISAPI_Rewrite to get rid of /productcart/pc/
Date Posted: 18-September-2009 at 12:41am
NOTE: This is probably NOT a good idea for sites that are already indexed under the traditional /productcart/pc/ directory structure (whatever you may have renamed "productcart" sub-directory to be).
We are in the process of launching over 20 new product cart stores, and we are not crazy about the extra two sub-directories PC forces (yeah, you could use the excuse that you could replace the /productcart/ sub-directory with something keyword rich, but we're not buying that really).
Our concern is mostly with SEO, and what tiny relevance may be gained by stashing a key word into the URL by renaming the /productcart/ sub-directory is lost by the way Google considers Page Rank -- specifically, one of the aspects of the way Google considers the Page Rank (not how a page ranks in the SERPs per se, but the PR factor it gives each page) is how many sub-directories away from the web root the file is -- so, PC is already forcing to levels away. This can be mitigated against somewhat with links to internal pages from the home page, but that isn't sufficient for large catalogs.
I've been working with Anton at Helicon Tech (the creators of ISAPI_Rewrite) and truth be told, even he was having trouble coming up with the right regex to perform the task of masking the /productcart/pc/ URL structure, but we finally cracked it this morning.
For anyone who is interested, here is what Anton finally came up with:
# Mask the /productcart/pc/ directory structure and make all such URLs look like they are in the web root: RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^([^/]+)$ productcart/pc/$1 [NC,L]
|
However, this opens up another can of worms: PC assumes all of it's images (buttons, product images, etc.) are relative (and therefore "below") the /productcart/pc/ sub-directory, so executing this breaks all of these src calls.
We're working on a solution for that. Unfortunately, I haven't figured out yet if ISPAPI_Rewrite might be used to correct for this, though I think it is possible. I'll report more as we press forward on this.
Finally, ISAPI_Rewrite is not an option for folks on most shared servers, and it's definitely NOT an option with "NoDaddy" hosting. However, many of us certified developers here do provide "boutique" hosting to our clients in which we do provide such options to our shared hosting clients. Otherwise, you would need to have a VPS (recommend JoltDigital) or a dedicated server (recommend Applied Innovations).
If you are interested to learn more about ISAPI_Rewrite, please see http://www.helicontech.com/isapi_rewrite/ - http://www.helicontech.com/isapi_rewrite/
More on this over the next week as I dig deeper into it.
|
Replies:
Posted By: whizzinpc
Date Posted: 23-September-2009 at 12:02pm
We tried a similar method but ended up just using the seo mod and leaving the the folders. Please keep us updated if you figure out the best way to achieve this. BTW, for people who already have pages indexed and want to use this.... ISAPI can 301 redirect those links to the new ones... and the ISAPI support team will help with the code.
|
Posted By: Guests
Date Posted: 24-September-2009 at 11:33pm
whizzinpc wrote:
We tried a similar method but ended up just using the seo mod and leaving the the folders. Please keep us updated if you figure out the best way to achieve this. BTW, for people who already have pages indexed and want to use this.... ISAPI can 301 redirect those links to the new ones... and the ISAPI support team will help with the code. |
Hi Whizz,
Just to be clear, we're not at all trying to use ISAPI_Rewrite to rewrite the query strings out of the URLs. I personally don't see much of an advantage taking that route, and it's very painful. I have absolutely no problem with the method EI uses in the SEO Mod (I've used that method for close to a decade).
What I have a problem with is burying all of the store pages two sub-directories deep as this is a factor in the way Google considers it Page Rank factor (the further away from the root, the less relavant the content is assumed to be). It's honestly not a huge big deal, but it's just not optimal either.
As for 301 redirecting, it shouldn't be an issue to write a condition and rule in ISAPI_Rewrite to 301 redirect all requested URLs with "/productcart/pc" in them back to the root with the same file name -- and if not using the SEO Mod, include the query string too. Once we get this all ironed out, we'll provide that. While we're at it, we'll provide the regex for making sure your site doesn't get indexed without www. in it's URL (for example, try http://wmsmerchantservices.com and notice that ISAPI_Rewrite pops the www. in there) so the site isn't indexed with and without www. (which is technically duplicate indexing).
However, if one wanted to do this, there are serious considerations to take. Redirecting all of ones pages like this after they've been indexed will cause a bit of a tail spin in Google for for a while -- probably at least 3 months, and longer depending on the volume of pages. I wouldn't necessarily recommend this for an existing indexed ProductCart site (unless there were some serious long range concerns and a cashflow that could withstand the hit), but once we get this ironed out, it would be idea for new sites on PC.
|
Posted By: slinc
Date Posted: 27-September-2009 at 11:06pm
Sean,
We have done extensive work with Helicon Rewriting in the past on product cart.
Our URL looks like this for category pages: www.mysite.com/category/widgetcategoryname (widgetcategoryname being any name we want)
Our URL for products looks like this: www.mysite.com/product/mywidgetname (mywidgetname being any name we want)
We store the value of "mywidgetname" and "widgetcategoryname" in a custom field in both the category and product admin screens.
We could have www.mysite.com/mywidgetname if we wanted. You would have to use the Helicon "Lookup" feature to do this. We do this on another site we run.
We have probably a good 40 hours invested in tweaking and testing to get it to work perfectly. Here are the rules we are using:
RewriteCond %{HTTP:Host} ^(.*\.)?mysite\.com|(.*\.)? mysite \.com|dev\. mysite \.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]
The code above rewrites the url and passes to the product cart page something like the following:
www.mysite.com/pc/viewCategories.asp?idCategory=widgetcategoryname
In the viewCategories.asp page I then have a few functions that convert "widgetcategoryname" into the actual category that I want to display. This gives me 100% control over the name of the url.
I added <base href='http://www.mysite.com/pc/'/> to the top of header.asp to help with image display problems. I also had to rewrite every URL in ProductCart with custom functions so that all links use the new SEO friendly urls.
I spent about 2 weeks working all this out but after it was all done it was fairly straight forward. The hardest part was the Regular Expressions and testing everything. I documented all my changes pretty well so I can upgrade to newer versions in a few hours.
Overall this works great as we have 100% control over the URL. This makes it easy to migrate old sites over to Product Cart as you can mimic the old URL if needed.
|
|