Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

[Contribution] Ultimate SEO URLs - by Chemo


Guest

Recommended Posts

Hya, i thought i would drop in here for a small question.

Last week I noticed that google was indexing my pages with the correct url description, but the url link was being messed up as soon as I had accents inside of it.

 

So for instance, a search finding our shop would shop the non clickable link at the bottom in green correctly ( ../clip-photo-m?mo-n?mo-p-104.html ) but the url will be : .../clip-photo-m%C3%A9mo-n%C3%A9mo-p-104.html.

 

I guess this is a problem with google and i am not sure how to get around it, since i would prefer to have the accents still displayed in the green non clickable link, its nicer to the eyes if you read french, but it bother me a bit to have messy link arriving at my shop, even though they works.

 

Anyway, until someone come up with a perfect solution, I thought that i would simply remove the accents from the rewrite.

So i mande a small change to seo_cache.php, replacing

 

    $strip_array = array("'",chr(33),chr(34),chr(35),chr(36),chr(37),chr(38),chr(39),chr(40),chr(41),ch

r(42),chr(43),chr(44),chr(45),chr(46),chr(47),chr(58),chr(59),chr(60),chr(61),chr

(62),chr(63),chr(91),chr(92),chr(93),chr(94),chr(95),chr(96),chr(123),chr(124),ch

r(125),chr(126) ); 

    $convert_me = str_replace($strip_array, '', $convert_me);

    $convert_me = str_replace(array(' ', '  ', '__', '--'), '-', $convert_me);

    $convert_me = strtolower($convert_me);

 

with

 

    $convert_me    = htmlentities(strtolower($convert_me));

    $convert_me    = preg_replace("/&(.)(acute|cedil|circ|ring|tilde|uml);/", "$1", $convert_me);

    $convert_me    = preg_replace("/([^a-z0-9]+)/", "-", html_entity_decode($convert_me));

    $convert_me    = trim($convert_me, "-");

 

Not sure if this is useful to anyone else, seems to works fine so far after reseting the cache.

If Chemo or Claroque got a better way of having those accent being picked ok by GG I am very interested

Link to comment
Share on other sites

  • Replies 1.9k
  • Created
  • Last Reply

Top Posters In This Topic

Very nice :) I'm working on v3 series (see my blog for details) and use better code to form the URLs. I use regex to strip all the punctuation and encoded characters. It's not perfect but gets about 98% of them...

 

Bobby

Link to comment
Share on other sites

Didnt know you had a blog :)

I am not sure if regex are any faster, but they look a bit more fancy even if its then harder to remember what they actually do :P

 

Keeping referencing in mind, it might be an idea to leave some option open to have some keywords in the rewriting. So basically instead of just picking the product name, do something like keyword-product name.htm if you see what I mean.

I guess the best way would be for that keyword to be the category name ..maybe something to think about, maybe not!

 

Hey i also wanted to mentionned that I found another use for your 301 redirect of old URL. for some reason, GG still managed to index some non rewrited pages, dunno how but when people get to the pages, its working fine and they arrive where they should be, but I have no clue, looking at the log, as to which product they arrived on. So installed the 301 beta and voila .. So thanks again for a great job!

Link to comment
Share on other sites

regex is not not significantly faster than the PERL compatible expression (in the bigger scheme of things) bit is my preference when not optimizing (+S).

 

In the v3.0 series I will leave an open door to use whatever keywords a store owners wants: product or category name, model number, whatever. I'm coding v3.0 to be as versatile as possible.

 

Bobby

Link to comment
Share on other sites

BTW, for anyone still following this contribution I've posted a feedback thread for the v3.0 series development. I outline what I'm planning for the v3.0 series and ask for feedback on what additional features should be included.

 

Be sure to stop by and add some feedback...it's easier to add features while in development than in maintenance releases.

 

Ultimate SEO URLs v3.0 Features

 

Bobby

Link to comment
Share on other sites

Hi,

 

SEO URLS is excellent! I was wondering how to make it display just the model number as the url.

 

EX: www.watchkings.com/snl011.html, instead of the name with the -p- at the end.

 

The problem is that we update our products frequently, and the cached version on google soon turns out to be a PRODUCT NOT FOUND. By putting the MODEL only as the URL, this will solve the problem, as well as with internal linking to individual product pages from content pages.

 

Can you please help us with this issue?

 

Great Job on the Contrib CHEMO!

Link to comment
Share on other sites

Hi,

i istalled the contibution version 2.0. Now i get the following error:

 

Warning: gzinflate(): buffer error in /home/httpd/vhosts/emma-lee.de/httpdocs/includes/classes/cache.class.php on line 152

 

Can anybody help me??

 

thx

Link to comment
Share on other sites

I have a minor problem with this wonderful contrib.

 

I?m using Categories Tabs withs subs.

 

I have modified muy URLs to parse product_id AND cpath.

 

If i use Ultimate SEO URLs, cpath is not in url, and in my product page, my tabs menu is withouth a category.

 

I need to modified this contrib to add cpath in the URL of the product info page, i know how to modify .htaccess, but i dont know how to modify this contrib.

 

An example will be:

 

NOW:

http://site.com/my-product-p-37.html

 

WITH THE REQUIRED MODIFICATION:

http://site.com/my-product-c-1_10-p-37.html

 

 

Any Help would be apreciated.

 

Thanks in advance.

Link to comment
Share on other sites

Why not use some simple regex to extract the products_id from the URL then create a function to get the cPath?

 

Bobby

 

Thanks for your reply bobby.

 

This sounds good, but my php skills are... so poor :(

 

What is the easiest way, the function to find the path with the product ID, or add cpath to product info URL ?

 

Thanks

Link to comment
Share on other sites

As you say in this post, in aplication_top cpath is defined, without passing it by url.

 

I will try to "repair" Categories tabs contrib.

 

Thanks for pointing me in the correct direction!

Maybe I'm misunderstanding your requirements...

 

It is true that the cPath variable is set on each page regardless of whether it's passed as a GET parameter or not. However, I interpreted your requirement as parsing each URL formed with the tep_href_link() function so that the cPath variable associated with THAT PARTICULAR URL is available...not the cPath of the current page the customer is browsing.

 

Bobby

Link to comment
Share on other sites

Maybe I'm misunderstanding your requirements...

 

May be, my english is awfull. :blush:

 

I need to build an URL with cpath, because if i don?t, my categories tabs contribution, doesn?t show the current category and subcategorie.

 

I have tryed with aplication_top function to determine cpath without parsing it by GET, but without results :'(

 

I think is more easy to build a rewrite url with cpath, can you point me in the correct direction?

 

Thanks.

Link to comment
Share on other sites

I am getting the following error trying to login to the admin:

 

Parse error: parse error, unexpected T_CASE in /****/*****/******/catalog/admin/includes/application_top.php on line 393

 

I can view the catalog, but I cannot get into the admin. I did have to manually do some file editing in the

 

*catalog*/includes/modules/product_listing.php

 

As the code you are asking me to replace was not there, but relatively close...

 

Please help, I love this mod, but I can't get it to work this time...

 

PS: I installed via fantastico...

Link to comment
Share on other sites

Clarocque or bdneuman,

 

That did it!  Along with the if statement in seo_redirect, the link from the cart now works and keeps the attributes.

 

Are you aware of any contrib's (i've looked) that add the ability to "Update" the attributes of an item already in the cart without having to use the "Add to Cart" button and delete the old item?  Not a big deal, I suppose, it just seems like a nice feature...

 

Thanks again for the great contrib and all of the support!

 

 

I was having the same problem as brian (bdneuman) with my product attributes not being carried into the final cart once they were added and then edited. Last week I made the changes that you recommended above and it seemed to work for a day or so and then the same problem started happening again with the product attributes. Do you see any other possible causes or fixes to this problem, or do you know of any contributions that would interfere with this solution working? I'm not sure what to do or how I can get this fix. Thanks for any insight you may have! If you want to check my website, its momentsofelegance.com (but its live so be careful!)

 

Thanks!!

Ashley

Link to comment
Share on other sites

Clarocque or bdneuman,

I was having the same problem as brian (bdneuman) with my product attributes not being carried into the final cart once they were added and then edited.  Last week I made the changes that you recommended above and it seemed to work for a day or so and then the same problem started happening again with the product attributes.  Do you see any other possible causes or fixes to this problem, or do you know of any contributions that would interfere with this solution working?  I'm not sure what to do or how I can get this fix.  Thanks for any insight you may have!  If you want to check my website, its momentsofelegance.com (but its live so be careful!)

 

Thanks!!

Ashley

 

It looks like something else is going on here - I can't even get your products into a cart w/ cookies disabled. My problem always happened once the product was in the cart (at shopping_cart.php). I'll let the pro's weigh in on this for you, but your probably going to have to give some more details on your specific code...

Brian Neuman

Link to comment
Share on other sites

Hi Bobby,

Just copied my site to another server. Ultimate ran great until I deleted the cache file now I get this on the main page...

Warning: fopen(tmp/ultimate_seo_cache/seo_english.cache): failed to open stream: Permission denied in /home/virtual/site264/fst/var/www/html/includes/seo_cache.php on line 199

 

Warning: fwrite(): supplied argument is not a valid stream resource in /home/virtual/site264/fst/var/www/html/includes/seo_cache.php on line 200

 

Warning: fclose(): supplied argument is not a valid stream resource in /home/virtual/site264/fst/var/www/html/includes/seo_cache.php on line 201

 

Warning: main(tmp/ultimate_seo_cache/seo_english.cache): failed to open stream: No such file or directory in /home/virtual/site264/fst/var/www/html/includes/seo_cache.php on line 204

 

Warning: main(): Failed opening 'tmp/ultimate_seo_cache/seo_english.cache' for inclusion (include_path='.:/php/includes:/usr/share/php') in /home/virtual/site264/fst/var/www/html/includes/seo_cache.php on line 204

 

Any insight is appreciated.

Kind Regards, KJ

define('PROJECTS', 'Something that goes on forever!');

Link to comment
Share on other sites

Found out the problem...

 

When copied over the cache folder went to 755, I changed to 777 and all seems fine. Great Contrib, it even moves to other servers without a hitch!

 

--KJ

define('PROJECTS', 'Something that goes on forever!');

Link to comment
Share on other sites

Windows 2003 IIS.... PROBLEMS

 

I installed exactly as instructed 3 times... I am still haveing the same problem....

SEE PROBLEM LIVE

When I click on a catagory it pulls up an all catagories page instead of that specific catagory. but when I click on a catagory in the new window it goes there... to the correct place :( chemo thinks it is a problem in my application_top.php I dont think so... so here is the code...

<snip>

-Going Crazy any Ideas?

 

edit: Please do not post your entire file! Only the relevant lines are needed (see Chemo's post below).

Edited by BlueNoteMKVI
Link to comment
Share on other sites

As I told you on Live Help the problem is in application_top.php and will have to be debugged for YOUR Windows server setup. The issue is in this block of code:

// include the language translations
require(DIR_WS_LANGUAGES . $language . '.php');
# include the cache class
include('includes/classes/cache.class.php');
$cache = new cache($languages_id);
# include the Ultimate SEO URLs cache file
include('includes/seo_cache.php');
# Get the cache - no parameters will get all GLOBAL cache entries for this language
$cache->get_cache('GLOBAL');


if ( isset($HTTP_GET_VARS['cName']) && defined(urldecode($HTTP_GET_VARS['cName'])) ) {
$cPath = str_replace( 'cPath=', '', constant(urldecode($HTTP_GET_VARS['cName'])) );
$HTTP_GET_VARS['cPath'] = $cPath;
}
if (isset($HTTP_GET_VARS['pName']) && defined(urldecode($HTTP_GET_VARS['pName'])) ) {
$pid = str_replace('products_id=', '', constant(urldecode($HTTP_GET_VARS['pName'])));
$HTTP_GET_VARS['products_id'] = (int)$pid;
}

It is either not pulling the cache and evaluating the defined constants or there is some other issue with cPath's not matching up. Either way be assured you will find the problem with those lines of code. It cannot be located anywhere else.

 

Bobby

Link to comment
Share on other sites

Hello everyone,

 

I am reposting this as I posted in the wrong thread, and couldnt move it. :blush:

 

Chemo, excellent contribution! I have just become aware of OScommerce after 2 years of hosting my ecommerce site on Yahoo, and have read your posts on digitalpoint.com I am excited to create and transition to an OS commerce store with a strong SEO backbone, and this is my first contribution (and first post) on a freshly installed site.

 

I have a question, as I have some trouble with getting 404 pages for any product or cateogory. However, the URL's are correct, its just that the page is missing.

 

I have the feeling that I am about a hair away from resolving the issue, however I am stuck as PHP is not my strong suit (by a long shot). I think the problem lies in the .htacess, but I cannot figure out what I have done wrong.

 

My problem is almost identical to this post:

 

 

As far as troubleshooting, I have done the following:

 

Read every post in this string 2x.

Installed and reinstalled 2x.

Rewritten the .htaccess 3x. (in both the folder and root)

And tried to troubleshoot to the best of my ability.

 

My teststore is located at store(dot)fossilflyimports(dot)com, and loads fine.

However the product or item pages come up as 404, but the URL resolves as an proper SEO url.

 

Thank you in advance for any suggestions.

 

charlie

Link to comment
Share on other sites

I also am having a problem I don't know how to fix, I am getting a lot of 404 when spidering and have no idea where the links are coming from, but they all have somethig like "?page=6&cPath=17_29_39" appdened to the end of the links.

 

The links that are fine when spidered end just in .html.

 

Anyone know why the spider would be seeing the odd links?

 

Is it the .htaccess I have? this is from the contribution.

 

Options +FollowSymLinks
RewriteEngine On 
RewriteBase /
RewriteRule ^(.*)-p-(.*).html$ product_info.php?products_id=$2&%{QUERY_STRING}
RewriteRule ^(.*)-c-(.*).html$ index.php?cPath=$2&%{QUERY_STRING}
RewriteRule ^(.*)-m-(.*).html$ index.php?manufacturers_id=$2&%{QUERY_STRING}

 

Thanks for any help.

The way of life, and the way we work for you.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...