Forum Moderators: phranque

Message Too Old, No Replies

mod rewrite - visitors flip back n forth between seo and non-seo urls?

non-seo and seo urls back and forth for visitors

         

wyattea

12:22 pm on May 17, 2008 (gmt 0)

10+ Year Member



My site went live with a new cart. I'm using the seo url feature of the cart (click cart pro) and i'm looking at my stats and seeing people visiting seo based pages and then non-seo based pages. The cart people are saying it's normal for people to hit a page and see non-seo urls first, but then after going to a 2nd page getting the seo urls (basically on first page hit, all my categories in the sidebar are non-seo, and if they click on a category, the next page will have seo urls for the category list.

This just doesn't seem right (but my experience is minimal with mod_rewrite). Here's my php code for the backend and my htaccess contents if anyone can make sense of this:


$seo_status = $this->globals('khxc_settings.khxc.seo_status');

if ((!($print_sid)) && (!($print_portrelay)) && (!($ssllink)) && ($seo_status) && ($seo_paramstatus)) {

$script = preg_replace('/\.php$/','',$url['script']);

$href_url = $url['base_href'] . '/';

$app = (isset($url['params']['app']) ? $url['params']['app'] : 'KHXCseo');
$ns = (isset($url['params']['ns']) ? $url['params']['ns'] : 'KHXCseo');
$ref = (isset($url['params']['ref']) ? $url['params']['ref'] : 'KHXCseo');

$app = urlencode($app);
$ns = urlencode($ns);
$ref = urlencode($ref);

$href_url .= $app . '-' . $ns . '/' . $ref . '.php';

$href_url = preg_replace('/' . $app . '-catshow/','category',$href_url);
$href_url = preg_replace('/' . $app . '-prodshow/','gift',$href_url);
$href_url = preg_replace('/' . $app . '-display/','reference',$href_url);
$href_url = preg_replace('/' . $app . '-prodspec\/KHXCseo.php/','store-specials.php',$href_url);
$href_url = preg_replace('/' . $app . '-prodnew\/KHXCseo.php/','new-products.php',$href_url);
$href_url = preg_replace('/' . $app . '-prodall\/KHXCseo.php/','view-all-products.php',$href_url);
$href_url = preg_replace('/' . $app . '-prodidx\/KHXCseo.php/','product-index.php',$href_url);
$href_url = preg_replace('/' . $app . '-prodbest\/KHXCseo.php/','best-sellers.php',$href_url);
$href_url = preg_replace('/' . $app . '-prodsearch\/KHXCseo.php/','advanced-product-search.php',$href_url);
$href_url = preg_replace('/' . $app . '-contact\/KHXCseo.php/','contact-us.php',$href_url);
$href_url = preg_replace('/' . $app . '-viewcart\/KHXCseo.php/','view-shopping-cart.php',$href_url);
$href_url = preg_replace('/' . $app . '-acctorders\/KHXCseo.php/','order-status.php',$href_url);
$href_url = preg_replace('/' . $app . '-accountmaint\/KHXCseo.php/','account-maintenance.php',$href_url);
$href_url = preg_replace('/' . $app . '-changeemail\/KHXCseo.php/','change-email-address.php',$href_url);
$href_url = preg_replace('/' . $app . '-changepass\/KHXCseo.php/','change-password.php',$href_url);
$href_url = preg_replace('/' . $app . '-addbook\/KHXCseo.php/','address-book.php',$href_url);
$href_url = preg_replace('/' . $app . '-logout_proc\/KHXCseo.php/','account-logout.php',$href_url);

and:

ErrorDocument 404 /404.html

Options +FollowSymLinks
RewriteEngine On
RewriteRule ^category/(.*)\.php index.php?app=ccp0&ns=catshow&ref=$1 [L,PT]
RewriteRule ^gift/(.*)\.php index.php?app=ccp0&ns=prodshow&ref=$1 [L,PT]
RewriteRule ^reference/(.*)\.php index.php?app=ccp0&ns=display&ref=$1 [L,PT]
RewriteRule ^store-specials.php index.php?app=ccp0&ns=prodspec [L,PT]
RewriteRule ^new-products.php index.php?app=ccp0&ns=prodnew [L,PT]
RewriteRule ^view-all-products.php index.php?app=ccp0&ns=prodall [L,PT]
RewriteRule ^product-index.php index.php?app=ccp0&ns=prodidx [L,PT]
RewriteRule ^best-sellers.php index.php?app=ccp0&ns=prodbest [L,PT]
RewriteRule ^advanced-product-search.php index.php?app=ccp0&ns=prodsearch [L,PT]
RewriteRule ^contact-us.php index.php?app=ccp0&ns=contact [L,PT]
RewriteRule ^view-shopping-cart.php index.php?app=ccp0&ns=viewcart [L,PT]
RewriteRule ^order-status.php index.php?app=ccp0&ns=acctorders [L,PT]

RewriteRule ^account-maintenance.php index.php?app=ccp0&ns=accountmaint [L,PT]
RewriteRule ^change-email-address.php index.php?app=ccp0&ns=changeemail [L,PT]
RewriteRule ^change-password.php index.php?app=ccp0&ns=changepass [L,PT]
RewriteRule ^address-book.php index.php?app=ccp0&ns=addbook [L,PT]
RewriteRule ^account-logout.php index.php?app=ccp0&ns=logout_proc [L,PT]
RewriteRule ^(.*)-(.*)/(.*)\.php index.php?app=$1&ns=$2&ref=$3 [L,PT]

Any help is appreciated!

Regards,

James...

wyattea

12:24 pm on May 17, 2008 (gmt 0)

10+ Year Member



oops, forgot to provide web-stat proof of visit:

Visting many seo-urls, then suddenly a non-seo url (gifts 50 to 100 on line #9):

Click # Timestamp URL visited Duration of Stay 
1 Fri May 16 at 11:29:03 PM www.mysite.com 7 seconds
2 Fri May 16 at 11:29:10 PM www.mysite.com/index.php?app=ccp0&ns=prodshow&ref=baby-gift-basket-wild-child-009600&sid=966bymbv28hs59d4oxq7e6xw1445c8u1 9 seconds
3 Fri May 16 at 11:29:19 PM www.mysite.com/category/birthday-gift-baskets.php 6 seconds
4 Fri May 16 at 11:29:25 PM www.mysite.com/gift/birthday-gift-basket-monkey-business-007800.php 10 seconds
5 Fri May 16 at 11:29:35 PM www.mysite.com/gift/gift-basket-cozy-coffee-007600.php 8 seconds
6 Fri May 16 at 11:29:43 PM www.mysite.com/gift/birthday-gift-basket-dinosaurus-007400.php 12 seconds
7 Fri May 16 at 11:29:55 PM www.mysite.com/category/gifts-50-to-100.php 11 seconds
8 Fri May 16 at 11:30:06 PM www.mysite.com/gift/baby-gift-basket-precious-006100.php 12 seconds
9 Fri May 16 at 11:30:18 PM www.mysite.com/index.php?app=ccp0&ns=catshow&ref=gifts-50-to-100&count=20&offset=20 6 seconds
10 Fri May 16 at 11:30:24 PM www.mysite.com/gift/child-gift-basket-little-princess-007500.php 8 seconds
11 Fri May 16 at 11:30:32 PM www.mysite.com/gift/child-gift-basket-happy-day-008000.php 20 seconds
12 Fri May 16 at 11:30:52 PM www.mysite.com/gift/gourmet-gift-baskets-take-a-break-008200.php 8 seconds
13 Fri May 16 at 11:31:00 PM www.mysite.com/index.php?app=ccp0&ns=catshow&ref=gifts-50-to-100&count=20&offset=40 6 seconds

wyattea

12:30 pm on May 17, 2008 (gmt 0)

10+ Year Member



sorry for the multiple posts - i just noticed that example isn't good since it's visiting a subpage of the gifts 50 to 100 (page 2 and 3 of same page which isn't seo'd. Here's a better example:

Click # Timestamp URL visited Duration of Stay 
1 Sat May 17 at 04:43:25 AM www.mysite.com/category/candy-bouquets.php 1 minute and 11 seconds
2 Sat May 17 at 04:44:36 AM www.mysite.com/index.php?app=ccp0&ns=catshow&ref=candy-bouquets&sid=uy28114j8p1g87818972jioihx46g42q 9 seconds
3 Sat May 17 at 04:44:45 AM www.mysite.com/category/gifts-under-50.php no further activity at this time

they hit the seo url for candy bouquets...and then must have clicked on the sidebar link to the same category which ISN'T seo url'd...this just ain't right! I have another cart with seo features and you NEVER see non-seo urls regardless of whether it's your first visit.

James...

jdMorgan

2:43 pm on May 17, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



> and then must have clicked on the sidebar link to the same category which ISN'T seo url'd

There should be no dynamic links at all on any of your pages when you do View->Page source. If there are, then the script or the plug-in needs to be fixed. The links appearing on your pages *define* the URLs, and if they're not 100% static (Search-Engine-friendly), then you've got problems. No amount of mod_rewrite can correct this problem -- The script or the plug-in must be corrected.

Jim

wyattea

4:50 pm on May 17, 2008 (gmt 0)

10+ Year Member



is there anything in my pasted code (not the rewrite stuff) that looks wrong...or could be the reason for the issue?

jdMorgan

5:06 pm on May 17, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



No. Your code cannot affect the URL requested by the client and logged in your access logs, because all of your RewriteRules are internal rewrites, not redirects. Therefore as I stated, the problem is the links on your pages not the code. A simple View->Page Source in your browser will confirm this.

Jim

wyattea

2:55 am on May 18, 2008 (gmt 0)

10+ Year Member



Jim, I found an interesting thing - you could be visiting dozens of seo-url'd pages, but if you visit a non-seo url page (like 'account menu' which is normally non-seo (with a SID), the category links show non-seo urls. I've tried this on another site that uses the cart and they have the same issue. But I tried hitting a category where there's multiple pages so page 2, 3, etc aren't seo'd (just not defined as such ) but that doesn't make the urls on the page change to non-seo'd.

I know you don't know how the cart code was made so you can't know for sure what's wrong but I was hoping your experience might help in knowing what could be wrong if the urls don't get rewritten because of visiting a non-seo url with an SID...well, can't hurt to ask :)

Thanks,

James...