Jump to content
spidometrs

[CONTRIBUTION] Ultimate SEO URLs v2.1 - by Chemo

Recommended Posts

this is also the reason as to why you should add a 404 header in the paging class for when pages are requested which are no longer valid.

 

say you used to have 3 pages of a product listing.

the se's will have indexed

/index.php?cPath=1

/index.php?cPath=1&page=1

/index.php?cPath=1&page=2

/index.php?cPath=1&page=3

 

but now you only have 2 pages left

If the se comes back to get /index.php?cPath=1&page=3 he should get a 404, but not with osc, osc simply gives the content of page 2. So now the se has /index.php?cPath=1&page=2 and /index.php?cPath=1&page=3 and they both contain the same content, the content of /index.php?cPath=1&page=2

 

Mind you,

 

/index.php?cPath=1

/index.php?cPath=1&page=1

 

have the same content by definition.

thanks for the clarification (and Roger too)


Upon receiving fixes and advice, too many people don't bother to post updates informing the forum of how it went. Until of course they need help again on other issues and they come running back!

 

Why receive the information you require in good faith for free, only to then have the attitude to ignore the people who gave it to you?

 

There's no harm in saying, 'Thanks, it worked'. On the contrary, it creates a better atmosphere.

 

CHOOCH

Share this post


Link to post
Share on other sites
boxtel,

 

I took a look at your site. Very nice BTW. I went to a product page and edited the url:

 

http://www.crystallight.com.tw/rose-somete...e-3-A-1272.html

 

When I put that in my browser, the text stays the same and is not redirected to:

 

http://www.crystallight.com.tw/rose-quartz...d-3-A-1272.html

 

I am sorry, it this what it was suppose to do? I may have misread what your post is suppose to do.

 

- Roger

 

you have to come in as a spider as you would only do this for spiders.

It basically is only an se index issue so there is no need to do the extra code execution for users.

 

so use FF, disable cookies, set the useragent to a known spider and then the magic happens...


Treasurer MFC

Share this post


Link to post
Share on other sites
It's me again. Just thought it would make things easier if I provided more details. The product URL looks like:

http://www.MYSTORE.com/courage-under-fire-p-16.html

 

when I click "Add to Cart", I get the same product page with the following URL:

http://www.MYSTORE.com/courage-under-fire-...ion=add_product

 

Also, from the list of products listed under a given category, when I clicked "Buy Now", I was taken to the cart contents page where it reads "Your shopping cart is empty" and the URL looks:

http://www.MYSTORE.com/shopping_cart.php?a...ucts_id=20&

 

As you see the "amp;" is still shown up in the URLs despite the fact that I installed fixes submitted by edgecrush3r and bchecketts. Although the seo.cache.php file they uploaded to the contrib looks different from the one I installed from Emmett's latest version, But I did the best I can to add their fixes.

 

So, according to bchecketts' fix, the function do_redirect() is as follows:

function do_redirect(){
$p = @explode('&', $this->uri_parsed['query']);
foreach( $p as $index => $value ){							
$tmp = @explode('=', $value);
switch($tmp[0]){
	 case 'products_id':
	if ( $this->is_attribute_string($tmp[1]) ){
		$pieces = @explode('{', $tmp[1]);							
		$params[] = $tmp[0] . '=' . $pieces[0];
	} else {
		$params[] = $tmp[0] . '=' . $tmp[1];
		  }
	break;
	default:
		$params[] = $tmp[0].'='.$tmp[1];
	break;						
	  }
	} # end foreach( $params as $var => $value )
	$params = ( sizeof($params) > 1 ? implode('&', $params) : $params[0] );		
	$url = $this->href_link($this->uri_parsed['path'], $params, 'NONSSL', false);
	  # BC Redirects shouldn't have '&'s in them
$url = preg_replace('/&/','&',$url);

	switch(true){
		case (defined('USE_SEO_REDIRECT_DEBUG') && USE_SEO_REDIRECT_DEBUG == 'true'):
			$this->attributes['SEO_REDIRECT']['REDIRECT_URL'] = $url;
			break;
		case ($this->attributes['USE_SEO_REDIRECT'] == 'true'):
			header("HTTP/1.0 301 Moved Permanently"); 
			header("Location: $url"); // redirect...bye bye		
			break;
		default:
			$this->attributes['SEO_REDIRECT']['REDIRECT_URL'] = $url;
			break;
	} # end switch
} # end function do_redirect

Also, according to edgecrush3r's fix, the function href_link() is as follows:

function href_link($page = '', $parameters = '', $connection = 'NONSSL', $add_session_id = true){
	$this->start($this->timestamp);
	$this->performance['NUMBER_URLS_GENERATED']++;
	if ( !in_array($page, $this->attributes['SEO_PAGES']) || $this->attributes['SEO_ENABLED'] == 'false' ) {
		return $this->stock_href_link($page, $parameters, $connection, $add_session_id);
	}
	$link = $connection == 'NONSSL' ? $this->base_url : $this->base_url_ssl;
	$separator = '?';
	if ($this->not_null($parameters)) { 
		$link .= $this->parse_parameters($page, $parameters, $separator);	
	} else {
	  $link .= $page;
	}
	$link = $this->add_sid($link, $add_session_id, $connection, $separator); 
	$this->stop($this->timestamp, $time);
	$this->performance['TOTAL_TIME'] += $time;
	switch($this->attributes['SEO_URLS_USE_W3C_VALID']){
		case ('true'):
			if (!isset($_SESSION['customer_id']) && defined('ENABLE_PAGE_CACHE') && ENABLE_PAGE_CACHE == 'true' && class_exists('page_cache')){
				return $link;
		} else {
 		//return htmlspecialchars(utf8_encode($link));
											  return utf8_encode($link);
			}
			break;
		case ('false'):
			return $link;
			break;
	}
} # end function

And the function stock_href_link() has become:

function stock_href_link($page = '', $parameters = '', $connection = 'NONSSL', $add_session_id = true, $search_engine_safe = true) {
global $request_type, $session_started, $SID;
if (!$this->not_null($page)) {
  die('</td></tr></table></td></tr></table><br><br><font color="#ff0000"><b>Error!</b></font><br><br><b>Unable to determine the page link!<br><br>');
}
if ($page == '/') $page = '';
if ($connection == 'NONSSL') {
  $link = HTTP_SERVER . DIR_WS_HTTP_CATALOG;
} elseif ($connection == 'SSL') {
  if (ENABLE_SSL == true) {
	$link = HTTPS_SERVER . DIR_WS_HTTPS_CATALOG;
  } else {
	$link = HTTP_SERVER . DIR_WS_HTTP_CATALOG;
  }
} else {
  die('</td></tr></table></td></tr></table><br><br><font color="#ff0000"><b>Error!</b></font><br><br><b>Unable to determine connection method on a link!<br><br>Known methods: NONSSL SSL</b><br><br>');
}
if ($this->not_null($parameters)) {
  $link .= $page . '?' . $this->output_string($parameters);
  $separator = '&';
} else {
  $link .= $page;
  $separator = '?';
}
while ( (substr($link, -1) == '&') || (substr($link, -1) == '?') ) $link = substr($link, 0, -1);
if ( ($add_session_id == true) && ($session_started == true) && (SESSION_FORCE_COOKIE_USE == 'False') ) {
  if ($this->not_null($SID)) {
	$_sid = $SID;
  } elseif ( ( ($request_type == 'NONSSL') && ($connection == 'SSL') && (ENABLE_SSL == true) ) || ( ($request_type == 'SSL') && ($connection == 'NONSSL') ) ) {
	if (HTTP_COOKIE_DOMAIN != HTTPS_COOKIE_DOMAIN) {
	  $_sid = $this->SessionName() . '=' . $this->SessionID();
	}
  }
}
if ( (SEARCH_ENGINE_FRIENDLY_URLS == 'true') && ($search_engine_safe == true) ) {
  while (strstr($link, '&&')) $link = str_replace('&&', '&', $link);
  $link = str_replace('?', '/', $link);
  $link = str_replace('&', '/', $link);
  $link = str_replace('=', '/', $link);
  $separator = '?';
}
switch(true){
	case (!isset($_SESSION['customer_id']) && defined('ENABLE_PAGE_CACHE') && ENABLE_PAGE_CACHE == 'true' && class_exists('page_cache')):
		$page_cache = true;
		$return = $link . $separator . '<osCsid>';
		break;
	case (isset($_sid)):
		$page_cache = false;
		$return = $link . $separator . $_sid;
		break;
	default:
		$page_cache = false;
		$return = $link;
		break;
} # end switch
$this->performance['NUMBER_STANDARD_URLS_GENERATED']++;
$this->cache['STANDARD_URLS'][] = $link;
$time = 0;
$this->stop($this->timestamp, $time);
$this->performance['TOTAL_TIME'] += $time;
switch(true){
	case ($this->attributes['SEO_URLS_USE_W3C_VALID'] == 'true' && !$page_cache):

	//return htmlspecialchars(utf8_encode($return));
							  return utf8_encode($return);
		break;
	default:
		return $return;
		break;
}# end swtich
 } # end default tep_href function

 

Does anyone have any idea how to fix my cart problem?

 

By the way, I have both "valid XHTML Catalog Side 2.3" and "HTC" contribs installed.

 

Please help me!

 

Thanks

I would look at that valid xhtml contrib first as I assume that is turning the url parameter separators into &. always correct things at the core iso trying to "fix" the resulting symptoms elsewhere.


Treasurer MFC

Share this post


Link to post
Share on other sites
you have to come in as a spider as you would only do this for spiders.

It basically is only an se index issue so there is no need to do the extra code execution for users.

 

so use FF, disable cookies, set the useragent to a known spider and then the magic happens...

 

 

Oh very cool. Took me a bit to figure out how to change the useragent, but I found a FF plug-in that did the trick.

 

Have you thought about adding this to the contribution?

 

- Roger

Share this post


Link to post
Share on other sites
those are already semi-static pages in that they do not take parameters so there is no need for that.

just rename all_products.php to All-of-my-products-are-to-be-seen-here.html

 

Thanks Amanda.

Your right about the static pages, I had not thought about that.

 

The all_products.php rename, I'm not shore exactly what you mean with this but I don't think in heinsight it is really worth worry about that much. So I'll just leave wee enough alone.

Everything else on this contrib is working perfectly straight out of the box for me.

I fail to understand all the problems all the others are having.

My store is also very very heavily modified by myself, and apart from forgetting to upload the modified includes/application_top.php file, I had no problems what so ever.

 

I am quite staggered at the amount of people on this forum complaining of problems with the install.

The instructions are the best I have ever seen of any intructions from other contribs. Chemo has done a superb job of it.

I really think more people need to read the instructions very carefully, First before jumping and doing a thing.

The best way to modify your files, if your are already modified from other contribs is to use a file compare program like "Beyond Compare" along side a with a HTML editor so you can see all the code easily and work out what each bit of code is actually doing before just overwrite the code that was there, and work though it slowly. Don't be in a rush because that's when it gets F*ck it up.

If you have no idea at all what the code is doing you should perhaps train yourself with simpler contribs first and work your way up so as you start to get an idea of the codes, and it all starts to come together and make sense to you. If you don't have time to do this you should seriously consider paying someone to do it for you. You will save yourself a lot of headache and time and everyone else the same.

In so saying all of this as stated ealier, this contrib is very well documented so if you have trouble with this you should be taking a step backwards and finding some easier contribs to install first.

Always keep backups of your files even if, when you upload you Don't automatically overwrite but automatically rename as you upload. The you can easily start over.

(Just my 2 cents worth).

 

So thanks for your thoughts etc, Amanda and good luck to everyone else, I hope the words above will help some of you in how to go about things. (please don't respond with attacks at me on what I have said I am not trying to have ago at anyone, just adding my thoughts in the hope for smoother sailing for some of you at least.)

Share this post


Link to post
Share on other sites
Oh very cool. Took me a bit to figure out how to change the useragent, but I found a FF plug-in that did the trick.

 

Have you thought about adding this to the contribution?

 

- Roger

 

well, like I said, I am not sure if the latest versions of seo url's already redirects old seo url's to new seo url's or whether it only redirects non-seo url's to seo url's.

Maybe someone who uses those versions can say so I do not have to dig in that code to find out.


Treasurer MFC

Share this post


Link to post
Share on other sites
I am quite staggered at the amount of people on this forum complaining of problems with the install.

The instructions are the best I have ever seen of any intructions from other contribs. Chemo has done a superb job of it.

I really think more people need to read the instructions very carefully, First before jumping and doing a thing.

 

Well, I am pretty new at this, but I can say from what I have seen I do see how people get into trouble. I think it really depends how deep you go with the mods. I have had a few conflict to such a degree that I had to load a clean version of oscommerce and compare the mod with the clean version to see what they were changing, then take those changes and incorporate them into my text.

 

Recently, I think the user with the most problems started with the xHTML version and has added modifications from there. I would LOVE to do this also, but as I am not a programmer, more of a hacker, I do not feel as thought I can integrate modules that directly conflict with each other. Yes, you have to be careful, but I also feel that not all mods can work together so the art is being able to pick the ones that will.

 

My nickel to your 2 cents :)

 

Roger

Share this post


Link to post
Share on other sites
I would look at that valid xhtml contrib first as I assume that is turning the url parameter separators into &. always correct things at the core iso trying to "fix" the resulting symptoms elsewhere.

 

Thanks Amanda. I suppose I should check the url parameter separators in catalog/includes/functions/html_output.php. Right? I know that this seems to be a stupid question as I'm a newbie.

Share this post


Link to post
Share on other sites
Thanks Amanda. I suppose I should check the url parameter separators in catalog/includes/functions/html_output.php. Right? I know that this seems to be a stupid question as I'm a newbie.

 

well, I do not know what that contribution does, I never cared much for html validation.

Always seems to me like a rainy sunday afternoon homework excercise for people who want that little extra credit from their teachers or who have nothing to do.

I always look to add value to the clients first.

If they can prove that "validated html" actually adds value to my customers other than the business-wise irrelevant slogan "valid html" on my website, then I might consider it. I have not seen such evidence.

 

But tep_href_link() in html_output.php would be a good place to start.


Treasurer MFC

Share this post


Link to post
Share on other sites
Thanks Amanda.

Your right about the static pages, I had not thought about that.

 

The all_products.php rename, I'm not shore exactly what you mean with this but I don't think in heinsight it is really worth worry about that much. So I'll just leave wee enough alone.

Everything else on this contrib is working perfectly straight out of the box for me.

I fail to understand all the problems all the others are having.

My store is also very very heavily modified by myself, and apart from forgetting to upload the modified includes/application_top.php file, I had no problems what so ever.

 

I am quite staggered at the amount of people on this forum complaining of problems with the install.

The instructions are the best I have ever seen of any intructions from other contribs. Chemo has done a superb job of it.

I really think more people need to read the instructions very carefully, First before jumping and doing a thing.

The best way to modify your files, if your are already modified from other contribs is to use a file compare program like "Beyond Compare" along side a with a HTML editor so you can see all the code easily and work out what each bit of code is actually doing before just overwrite the code that was there, and work though it slowly. Don't be in a rush because that's when it gets F*ck it up.

If you have no idea at all what the code is doing you should perhaps train yourself with simpler contribs first and work your way up so as you start to get an idea of the codes, and it all starts to come together and make sense to you. If you don't have time to do this you should seriously consider paying someone to do it for you. You will save yourself a lot of headache and time and everyone else the same.

In so saying all of this as stated ealier, this contrib is very well documented so if you have trouble with this you should be taking a step backwards and finding some easier contribs to install first.

Always keep backups of your files even if, when you upload you Don't automatically overwrite but automatically rename as you upload. The you can easily start over.

(Just my 2 cents worth).

 

So thanks for your thoughts etc, Amanda and good luck to everyone else, I hope the words above will help some of you in how to go about things. (please don't respond with attacks at me on what I have said I am not trying to have ago at anyone, just adding my thoughts in the hope for smoother sailing for some of you at least.)

 

well, it is not a bad idea to make those semi-static pages also "a little" more seo friendly if you will.

You can use your keywords in the name just like seo url's does. That was a tip from Monika not so long ago.

 

so you could make them:

 

mainkeyword-special-offers.html

storename-sitemap.html

all-mainkeyword1-and-mainkeyword2-products-at-storename.html

 

so all you would have to do is change the filenames.

something like that.


Treasurer MFC

Share this post


Link to post
Share on other sites

 

Thanks for the link. I know I mentioned that I had checked that mod rewrite was enabled with my host. I did forget to mention that I also asked them what path to use. Using the path they provided, when I click on a product link Il get a 404 error mentioning "product_info.php was not found on this server."

 

Which makes no sense to me, since product info is definitely on the server. The instructions said there was no more conflicts with STS, so I assume it's not that. I was careful in merging my /admin/categories.php as well.

 

I just don't know where else, besides the .htaccess that could be causing this. And if it is the htaccess, why it is doing this. Mine looks exactly the same as the one that came with the distribution (2.1d from Nov. 29), minus begin/end SEO URL's comments.

 

Any help is greatly appreciated as I am really stuck. Everything shows up in the admin panel just fine. and if I turn it off the site runs ok. just can't enable them without the 404 errors popping up.

Share this post


Link to post
Share on other sites

Sorry for the double up post...

 

Here's my issue (and I agree, it definately falls into "the developer is the only one who will ever notice it" category)

 

Ultimate SEO works perfectly until... I give a product an attribute (option) and then add it to my cart. The link in the cart (and on shopping cart php) does not get SEO friendlied

 

ie http://www.botanicfanatic.com/appleberrycard-p-28.html

 

Add it to your cart and you'll see that both the link back to Appleberry Card in the cart at left and on shopping cart php points to http://www.botanicfanatic.com/product_info...ucts_id=28{1}14 not the SEO friendly url

 

My other test product has no attributes - http://www.botanicfanatic.com/blackwoodblossumcard-p-29.html - When you add it to the cart - the link back to it is SEOed just fine...

 

This would appear to be an issue with U-SEO not me... I've done a bit of digging through the Showcase and seen that whenever a product has an attribute this happens - and whenever it doesn't, this doesn't happen...

 

eg http://www.trendytreads.com/product/237/boulder-skate.html

 

Any ideas?

Share this post


Link to post
Share on other sites

There is no need for SEO friendly URLs within the shopping cart page.


Your online success is Paramount.

Share this post


Link to post
Share on other sites
There is no need for SEO friendly URLs within the shopping cart page.

 

I know exactly what Skipdaddyo means - basically, when a product with attributes is added to the shopping cart, if you click on the product that is in the shopping cart, the link for that product is not SEO'd. He is not talking about the shopping_cart.php page.

 

However, that being said, it shouldn't matter whether it is SEO'd or not, because Search Engines should not be able to add products to the shopping cart, which means they will never see that link in the shopping cart. So there is no point in trying to fix it.

 

So just leave it alone. No need to try and fix it.

 

Cheers,

Chris

Share this post


Link to post
Share on other sites
(and on shopping cart php)

 

Either way - SEO'd URLs are not required.

Edited by yesudo

Your online success is Paramount.

Share this post


Link to post
Share on other sites

Thanks guys :)

 

Being purely pedantic now... if you're using the google toolbar it will report the existence of these pages - so goog will know that they exist (and possibly index them)...

 

It would only be a very small fix - come on - you know you want to ;)

Share this post


Link to post
Share on other sites
well, it is not a bad idea to make those semi-static pages also "a little" more seo friendly if you will.

You can use your keywords in the name just like seo url's does. That was a tip from Monika not so long ago.

 

so you could make them:

 

mainkeyword-special-offers.html

storename-sitemap.html

all-mainkeyword1-and-mainkeyword2-products-at-storename.html

 

so all you would have to do is change the filenames.

something like that.

That's a good idea, if people use SEO URL's then the best thing to do is for them to be 'fully friendly' otherwise there's no point in installing this or other similar contributions.


Upon receiving fixes and advice, too many people don't bother to post updates informing the forum of how it went. Until of course they need help again on other issues and they come running back!

 

Why receive the information you require in good faith for free, only to then have the attitude to ignore the people who gave it to you?

 

There's no harm in saying, 'Thanks, it worked'. On the contrary, it creates a better atmosphere.

 

CHOOCH

Share this post


Link to post
Share on other sites
Add it to your cart and you'll see that both the link back to Appleberry Card in the cart at left and on shopping cart php points to http://www.botanicfanatic.com/product_info...ucts_id=28{1}14 not the SEO friendly url

Yes, i see what you mean. I checked your site and then my own. Even though it isn't really a big deal, it would be better for the return link to be like a normal SEO URL'd product info page as returning customers would see those specific pages and relate to them as 'this-page.html' rather than 'product_info.php etc etc'

 

Anyway, no big deal as this contribution is a great bonus to install anyway - but i do get what you mean.

Edited by chooch

Upon receiving fixes and advice, too many people don't bother to post updates informing the forum of how it went. Until of course they need help again on other issues and they come running back!

 

Why receive the information you require in good faith for free, only to then have the attitude to ignore the people who gave it to you?

 

There's no harm in saying, 'Thanks, it worked'. On the contrary, it creates a better atmosphere.

 

CHOOCH

Share this post


Link to post
Share on other sites
Yes, i see what you mean. I checked your site and then my own. Even though it isn't really a big deal, it would be better for the return link to be like a normal SEO URL'd product info page as returning customers would see those specific pages and relate to them as 'this-page.html' rather than 'product_info.php etc etc'

 

Anyway, no big deal as this contribution is a great bonus to install anyway - but i do get what you mean.

 

you could fix that by using tep_get_prid() in the function that writes the seo urls for products


Treasurer MFC

Share this post


Link to post
Share on other sites
Question:

Does the Ultimate SEO URL contrib

not work with the header tag support contrib?

 

 

I have both contribs installed and they work fine together.

Not much help I know :rolleyes:


"Know that this is your God, who could not consent to send anyone else to save you, but would come himself that he might gain for himself all your love." St Alphonsus Ligouri

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×