Jump to content
spidometrs

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

Recommended Posts

I agree, actually it wouldn't even matter if it detected if it was a search engine or not that would just be another hassle to code I would think. It would just need to detect if the url had changed, and if so redirect via 301 to the proper url, for the viewer it would be pretty much not noticable and then they could bookmark the proper page as well. Unfortunately I know very little about redirects so I'm not much more help than theory, maybe someone else can lead a hand?

They only reason I was suggesting to NOT do the redirect for general users was so that everything didn't get slowed down too much. It is only Search Engines that the URL really matters, as they are the only ones saving EVERY URL and caring that they have slightly changed.

But if anyone can even think of a way to fix this for EVERY visitor to the site, then that will be fine also.

 

Cheers,

Chris

Share this post


Link to post
Share on other sites

Quite new to os and this is the first time I've used a contibution like this. Looks great and its unfortunate that bobby can't offer his support on os anymore.

 

I'm going to post a problem several people have posted before and I'm aware they have, I have read all 46 pages in this forum and tried every solution offered to others for my problem, none have worked :(

 

When I click a product or catergry i get a 404 - page not found.

 

My .htaccess file has been ammended (using notepad) and the directory changed to catalog as my store runs from there.

 

the code now reads

 

# $Id: .htaccess,v 1.3 2003/06/12 10:53:20 hpdl Exp $

#

# This is used with Apache WebServers

#

# For this to work, you must include the parameter 'Options' to

# the AllowOverride configuration

#

# Example:

#

# <Directory "/usr/local/apache/htdocs">

# AllowOverride Options

# </Directory>

#

# 'All' with also work. (This configuration is in the

# apache/conf/httpd.conf file)

 

# The following makes adjustments to the SSL protocol for Internet

# Explorer browsers

 

<IfModule mod_setenvif.c>

<IfDefine SSL>

SetEnvIf User-Agent ".*MSIE.*" \

nokeepalive ssl-unclean-shutdown \

downgrade-1.0 force-response-1.0

</IfDefine>

</IfModule>

 

# If Search Engine Friendly URLs do not work, try enabling the

# following Apache configuration parameter

#

# AcceptPathInfo On

 

# Fix certain PHP values

# (commented out by default to prevent errors occuring on certain

# servers)

#

#<IfModule mod_php4.c>

# php_value session.use_trans_sid 0

# php_value register_globals 1

#</IfModule>

 

Options +FollowSymLinks

RewriteEngine On

RewriteBase /catalog/

 

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}

RewriteRule ^(.*)-pi-(.*).html$ popup_image.php?pID=$2&%{QUERY_STRING}

RewriteRule ^(.*)-t-(.*).html$ articles.php?tPath=$2&%{QUERY_STRING}

RewriteRule ^(.*)-a-(.*).html$ article_info.php?articles_id=$2&%{QUERY_STRING}

RewriteRule ^(.*)-pr-(.*).html$ product_reviews.php?products_id=$2&%{QUERY_STRING}

RewriteRule ^(.*)-pri-(.*).html$ product_reviews_info.php?products_id=$2&%{QUERY_STRING}

RewriteRule ^(.*)-i-(.*).html$ information.php?info_id=$2&%{QUERY_STRING}

 

 

I also checked for spaces in my html_output.php as someone suggested but didn't see any difference to bobbys code.

 

Any ideas much appreciated.

 

:blink:


This post was by Rob

 

I'm never lost - I just don't know how to get to where I want to be.

Share this post


Link to post
Share on other sites

hi,

 

my frontpage links always display :

-p-1.html

-p-5.html

 

and cagetory :

-c-1.html

-c-2.html

 

and Search engine always cache that links too, not complete links such my-product-p-1.html.

 

how to fix this problem.

Share this post


Link to post
Share on other sites

I added a Trade Mark symbol (raised TM) to one of my category pages and to several products pages. Now I'm getting a strange charactor in the URL (?). How can I get rid of this? Is there a place I can put in if the TM symbol is read not to include it in the URL?

 

Here is what the link looks like:

http://www.mywebsite.com/giorbello-mosai...s-c-23_155.html

 

Thanks in advance,

Mark

Share this post


Link to post
Share on other sites

Hi maybe someone can help me with this very strange problem

 

 

half the time my Urls are correctly formatted

 

ie: http://mysite.com/catalog/product-is-cool.html

 

The other half of the time

 

Urls are formatted correctly except the Session ID will append itself to the end of the URL

 

resulting in

 

ie: http://mysite.com/catalog/product-is-cool....FDSFG234432GC03

 

i also noticed whenever I run a spider simulator on my site it always comes back with the SID attached...

 

 

does anyone know why this is happening? I have tried resetting the cache..... Enabling and renabling the module to no avail....

 

Why would this happen?

 

if anyone could help this would be greatly appreciated... being that the contrib is working I wouldnt normally care except I am told that the appended OsCid will cause problems with Search engine spiders...

 

Thanks in advance

 

Indi

Share this post


Link to post
Share on other sites
i also noticed whenever I run a spider simulator on my site it always comes back with the SID attached...

does anyone know why this is happening?

Most likely because most search engine spider simulators do not send the correct user agent and thus is interpreted as a normal visitor (with cookies disabled). Try this spider simulator which was designed to test osC stores: osC Search Engine Spider Simulator

Share this post


Link to post
Share on other sites

Hi, I've just installed the Header Tags Controller ver2.5.9 on to a vanilla install. I now want to install SEO URLs ver2.1d. Does anyone know of any incompatibilities, will this work OK? Just want to check before I plod through the install :) Thanks.

Share this post


Link to post
Share on other sites
Well that was painless :) Works a treat.

 

Yeah, Ultimate SEO URL's was written by Bobby (Chemo), who wrote contribs that were the best and also the easiest to install. If only everyone could have learnt from him in how to write contribs (myself include hehe).

 

Its a pity he isn't around anymore. Never mind.

 

Cheers,

Chris ;)

Share this post


Link to post
Share on other sites

I have recently installed an extra "manufacturer" drop down menu, using the contrib

Manufacturer 2

Does anyone know how to rewrite URLs for this addition? Modifying the .htaccess is obviously not enough:

 

RewriteRule ^(.*)-m-(.*).html$ index.php?manufacturers_id=$2&%{QUERY_STRING}
RewriteRule ^(.*)-m2-(.*).html$ index.php?manufacturers2_id=$2&%{QUERY_STRING}

 

doesn't work.

 

Any help appreciated

 

hugh

 

www.thefrenchybee.com

Edited by pixclinic

Share this post


Link to post
Share on other sites

Hi,

 

I installed the Ultimate SEO URLs v2.1d. I have 2 problems that hopes someone can help me to fix it:-

 

1. If I choose the "Enable automatic redirects?" to "false" on the SEO URL in admin control panel, then, it is working. Otherwise, it doesn't work, why?

 

2.In the "product listing" page, The hyper-link in "product name" is not work, but the link in product image is working find.

Where can i find the code for that link and how can i fix it?

 

here is one of the link on my website for your reference:-

http://www.monstech.com/index.php?cPath=23...31a89bf9d1f8728

 

The link on the image is working correctly:-

http://www.monstech.com/product_info.php?c...31a89bf9d1f8728

 

The link on the product name is not work:-

http://www.monstech.com/product_info.php?n...31a89bf9d1f8728

Share this post


Link to post
Share on other sites

hey there, at my clients site, sometimes when you click on links it prompts you to login, would this be caused from the rewrite for the mod?

Share this post


Link to post
Share on other sites

I need to add a store_id from my category table but am having a tough time of it :'(

I need to have this added after the .html

 

This is the way it is now

http://website.com/cars-c-2.html

I need

http://website.com/cars-c-2.html?ID=1

the ?ID= is static

the number will vary by the store_id pulled from the categories table

 

Here is my code from seo.class.php

I have changed this '.html',

case ($page == FILENAME_DEFAULT):

$url = $this->make_url($page, $this->get_category_name($p2[1]), $p2[0], $p2[1], '.html' , $separator);

to this '.html?ID=' . $result['store_id'] ,

case ($page == FILENAME_DEFAULT):

$url = $this->make_url($page, $this->get_category_name($p2[1]), $p2[0], $p2[1], '.html?ID=' . $result['store_id'] , $separator);

 

full function here

case 'cPath':

global $store;

switch(true){

case ($page == FILENAME_DEFAULT):

$url = $this->make_url($page, $this->get_category_name($p2[1]), $p2[0], $p2[1], '.html?ID=' . $store->get_store_id , $separator);

break;

case ( !$this->is_product_string($params) ):

if ( $this->attributes['SEO_ADD_CPATH_TO_PRODUCT_URLS'] == 'true' ){

$container[$p2[0]] = $p2[1];

}

break;

default:

$container[$p2[0]] = $p2[1];

break;

} # end switch

break;

 

Here is the get category function

I have added c.store_id in the 1st SELECT and store_id in the 2nd SELECT

 

function get_category_name(&$cID){

$full_cPath = $this->get_full_cPath($cID, $single_cID); // full cPath needed for uniformity

switch(true){

case ($this->attributes['USE_SEO_CACHE_GLOBAL'] == 'true' && defined('CATEGORY_NAME_' . $full_cPath)):

$this->performance['CACHE_QUERY_SAVINGS']++;

$return = constant('CATEGORY_NAME_' . $full_cPath);

$this->cache['CATEGORIES'][$full_cPath] = $return;

break;

case ($this->attributes['USE_SEO_CACHE_GLOBAL'] == 'true' && isset($this->cache['CATEGORIES'][$full_cPath])):

$this->performance['CACHE_QUERY_SAVINGS']++;

$return = $this->cache['CATEGORIES'][$full_cPath];

break;

default:

$this->performance['NUMBER_QUERIES']++;

switch(true){

case ($this->attributes['SEO_ADD_CAT_PARENT'] == 'true'):

$sql = "SELECT c.categories_id, c.store_id, c.parent_id, cd.categories_name as cName, cd2.categories_name as pName

FROM ".TABLE_CATEGORIES." c,

".TABLE_CATEGORIES_DESCRIPTION." cd

LEFT JOIN ".TABLE_CATEGORIES_DESCRIPTION." cd2

ON c.parent_id=cd2.categories_id AND cd2.language_id='".(int)$this->languages_id."'

WHERE c.categories_id='".(int)$single_cID."'

AND cd.categories_id='".(int)$single_cID."'

AND cd.language_id='".(int)$this->languages_id."'

LIMIT 1";

$result = $this->DB->FetchArray( $this->DB->Query( $sql ) );

$cName = $this->not_null($result['pName']) ? $result['pName'] . ' ' . $result['cName'] : $result['cName'];

break;

default:

$sql = "SELECT store_id, categories_name as cName

FROM ".TABLE_CATEGORIES_DESCRIPTION."

WHERE categories_id='".(int)$single_cID."'

AND language_id='".(int)$this->languages_id."'

LIMIT 1";

$result = $this->DB->FetchArray( $this->DB->Query( $sql ) );

$cName = $result['cName'];

break;

}

$cName = $this->strip($cName);

$this->cache['CATEGORIES'][$full_cPath] = $cName;

$this->performance['QUERIES']['CATEGORIES'][] = $sql;

$return = $cName;

break;

} # end switch

$cID = $full_cPath;

return $return;

} # end function

 

I have also changed the

function generate_categories_cache(){ by adding the same changes as above

 

For some reason it will not generate the store_id

 

all I get is http://website.com/cars-c-2.html?ID= with no store_id #

 

It does not matter if I have caching turned on or off same result

I do have filter short words set to 0

everything else is vanilla settings

 

Any help in this will be appreciated

 

Terry

Share this post


Link to post
Share on other sites
I need to add a store_id from my category table but am having a tough time of it :'(

I need to have this added after the .html

 

This is the way it is now

http://website.com/cars-c-2.html

I need

http://website.com/cars-c-2.html?ID=1

the ?ID= is static

the number will vary by the store_id pulled from the categories table

 

Here is my code from seo.class.php

I have changed this '.html',

 

to this '.html?ID=' . $result['store_id'] ,

full function here

Here is the get category function

I have added c.store_id in the 1st SELECT and store_id in the 2nd SELECT

I have also changed the

function generate_categories_cache(){ by adding the same changes as above

 

For some reason it will not generate the store_id

 

all I get is http://website.com/cars-c-2.html?ID= with no store_id #

 

It does not matter if I have caching turned on or off same result

I do have filter short words set to 0

everything else is vanilla settings

 

Any help in this will be appreciated

 

Terry

 

Hey,

 

I do not think you need to have the Store_id at the END of the URL. You should still be able to embed it before the .html and it should still work without a problem (oscommerce does not even look at the URL, it simply strips out the variables and, in a way, re-forms the URL to what it is meant to be before the Ultimate SEO URL's touched it).

 

As for doing it, I unfortunately do not know how to do it.

I just found this link that shows you about adding multiple variables into a URL that might help: http://www.daniweb.com/techtalkforums/thread7826.html

 

Sorry I couldnt help any more.

 

Regards,

Chris

Share this post


Link to post
Share on other sites

Hi, I thought all was well but I've just noticed this error message in the config screen in admin. Any help fixing this would be appreciated, thanks.

 

Warning: call_user_func(tep_reset_cache_data_seo_urls): First argument is expected to be a valid callback in /data01/hcdvd/public_html/mysite.com/catalog/admin/includes/functions/general.php on line 1199

Share this post


Link to post
Share on other sites
Hi, I thought all was well but I've just noticed this error message in the config screen in admin. Any help fixing this would be appreciated, thanks.

 

 

Sorted it, I'm a numpty :)

Share this post


Link to post
Share on other sites
Found the solution to the problem regarding: amp;

 

This was posted by: lybrary

A big THX to him:)

Ok, after some more poking here is why this fails and how to correct it. I think this is a real bug. Comments appreciated. The function that causes the problem is function stock_href_link()

The last line is: return htmlspecialchars(utf8_encode($link));

Why is there a htmlspecialchars() function? This function turns every & into an &
I replaced it with:

return str_replace('"','"',str_replace('>','>',str_replace('<','<',utf8_encode($link))));

This does the same as htmlspecialchars except leaves the & unchanged, because these are the parameter separators.

It would be great to hear from the contribution author if my fix is ok or could cause other problems later on. Any other solution would be appreciated, too.

 

Hopes this helps all the others that have this problem!

 

Best Regards

Jan S

thanks, helped me heaps!!!

Share this post


Link to post
Share on other sites

I have a problem that seems linked to this contribution.

 

I cannot send reviews when installed. All I get is :

0 -

 

insert into reviews_description (reviews_id, languages_id, reviews_text) values ('0', '1', 'text')

 

[TEP STOP]

 

The wierd thing as well is they do appear in the admin part, but without text nor image as the first one.

 

And if I try to edit it as well in admin part, there are no error, but nothing is updated.

 

I'd need some help to debug, so if you have an idea to some particular file to look for in this process, or if it is a know bug maybe.

 

I have the correct code for negative indexes as I run the last version.

 

And when I uninstall it works.

 

Thanks.

Share this post


Link to post
Share on other sites

Hello,

 

Great contribution. It was working fine until I installed another contribution: (CCGV trad) then my products/categories/ and manufacturer links went dead. I get a 404 HTTP erro on IE and on Firefox I get an error that states that my links are redirecting and will never complete the page.

 

It worked perfect before I installed the other contrib. I would like to use both and have a few more to install. What are my options??

 

Thanks for any help.

 

Rod

Share this post


Link to post
Share on other sites
Hello,

 

Great contribution. It was working fine until I installed another contribution: (CCGV trad) then my products/categories/ and manufacturer links went dead. I get a 404 HTTP erro on IE and on Firefox I get an error that states that my links are redirecting and will never complete the page.

 

It worked perfect before I installed the other contrib. I would like to use both and have a few more to install. What are my options??

 

Thanks for any help.

 

Rod

 

Hi, I believe I have the CCGV contrib installed on my site (although im not currently using it), and Ultimate SEO URLs is working fine. So I dont think it would be to do with that, unless you installed the Contribs incorrectly.

 

My suggestion is to remove both contribs (you have a backup dont you??) and then install CCGV, and test that it works, and then try Ultimate SEO URLs. Ultimate SEO URLs is the easiest of the both to install, so its probably best for you to leave it till last so that there is less chance of making a mistake.

 

Regards,

Chris

Share this post


Link to post
Share on other sites

Chris,

 

Thanks for the tips. I actually readjusted my htacess file in my catagory folder and it works now. Somehow the mods I had made originally were gone and the pages were redirecting incorrectly.

 

Rod

Share this post


Link to post
Share on other sites

Hey Everyone,

 

I need your help.

 

Basically, I have some code from Bobby (Chemo) that will fix the problem with redirecting if the product name has changed, but it does NOT work in a CGI installation of PHP. So I need someone to try and get it working in CGI for me, as I am completely lost with this code.

 

NOTE: if you do not know what you are doing, DO NOT install this code in your website. It WILL break your website if you have PHP in CGI mode (if you dont know what this means, DO NOT install this).

 

Anyway, this code needs to be inserted into Application_top.php after the part where you declare Ultimate SEO URLs. One thing to note is that im using Chemo's official 2.1d that I uploaded in the contrib area. So here is the code, and if you can help me out with it then it would be greatly appreciated:

 

//// Redirect code for changing product names 
// Bobby Easland 
if ( is_numeric(strpos($_SERVER['REQUEST_URI'], '-c-')) ){ 
	// Run a regex to see if there are matches 
	preg_match_all("/(.*)-c-(.*)\.html/", trim($_SERVER['REQUEST_URI'], '/'), $matches, PREG_PATTERN_ORDER); 
	if ( sizeof($matches) > 0 ){ // a match was found 
		$uri_name = $matches[1][0]; 
		// get the cat ID and case as integer 
		$catID = $matches[2][0]; 
		// if they don't match let's redirect 
		if ($catID != 0  
			&& defined('CATEGORY_NAME_' . $catID)  
			&& $uri_name != $seo_urls->short_name(constant('CATEGORY_NAME_' . $catID))){ 
			$url = tep_href_link(FILENAME_DEFAULT, $_SERVER['QUERY_STRING'], 'NONSSL', false);				 
			header("HTTP/1.0 301 Moved Permanently"); // send the 301, moved permanently header 
			// close session (store variables) 
			tep_session_close(); 
			header ("Location: " . $url); // redirect...bye bye 
		} # end if  
	} # end if 
} 

if ( is_numeric(strpos($_SERVER['REQUEST_URI'], '-p-')) ){ 
	// Run a regex to see if there are matches 
	preg_match_all("/(.*)-p-(.*)\.html/", trim($_SERVER['REQUEST_URI'], '/'), $matches, PREG_PATTERN_ORDER); 
	if ( sizeof($matches) > 0 ){ // a match was found 
		// remove the -'s and convert to upper case 
		$uri_name = $matches[1][0]; 
		// get the products ID and case as integer 
		$products_id = (int)$matches[2][0]; 
		// if they don't match let's redirect 
		if ($products_id != 0  
			&& defined('PRODUCT_NAME_' . $products_id)  
			&& $uri_name != $seo_urls->short_name(constant('PRODUCT_NAME_' . $products_id))){ 
			$url = tep_href_link(FILENAME_PRODUCT_INFO, $_SERVER['QUERY_STRING'], 'NONSSL', false);			 
			header("HTTP/1.0 301 Moved Permanently"); // send the 301, moved permanently header 
			// close session (store variables) 
			tep_session_close(); 
			header ("Location: " . $url); // redirect...bye bye 
		} # end if  
	} # end if 
}

 

Cheers,

Chris

Edited by stonebridgecomputing

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

×