Jump to content
spidometrs

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

Recommended Posts

I have a store fully working with SEO URLS.

 

However, I'm moving a copy of the site (still with the same host) to new webspace and changing the domain name.

 

I copied a copy of the site accross to the new webspace, and made the configure db changes.

 

I had a problem with the URLS not showing on product_info pages , but then deleted the SEO cache from the db and the SEO URLS now work fine.

 

My problem - when I go to add a product to the cart, the cart shows as empty.

 

You'd think that as the site is exactely the same as the one fully working on the other webspace, and only a very slight change to the configure files, that it would work, but I have this empty cart problem.

 

Anyone able to help?

Share this post


Link to post
Share on other sites

hi all

 

STEP #3 - Edit includes/functions/html_output.php

Find the tep_href_link() function:

 

 

////
// The HTML href link wrapper function
 function tep_href_link($page = '', $parameters = '', $connection = 'NONSSL', $add_session_id = true, $search_engine_safe = true) {
global $request_type, $session_started, $SID;

if (!tep_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 ($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 (tep_not_null($parameters)) {
  $link .= $page . '?' . tep_output_string($parameters);
  $separator = '&';
} else {
  $link .= $page;
  $separator = '?';
}

while ( (substr($link, -1) == '&') || (substr($link, -1) == '?') ) $link = substr($link, 0, -1);

// Add the session ID when moving from different HTTP and HTTPS servers, or when SID is defined
if ( ($add_session_id == true) && ($session_started == true) && (SESSION_FORCE_COOKIE_USE == 'False') ) {
  if (tep_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 = tep_session_name() . '=' . tep_session_id();
	}
  }
}

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 = '?';
}

if (isset($_sid)) {
  $link .= $separator . $_sid;
}

return $link;
 }

////

 

And REPLACE with this function:

 

////
// Ultimate SEO URLs v2.1
// The HTML href link wrapper function
if (SEO_ENABLED == 'true') { //run chemo's code
 function tep_href_link($page = '', $parameters = '', $connection = 'NONSSL', $add_session_id = true, $search_engine_safe = true) {
	global $seo_urls;
			if ( !is_object($seo_urls) ){
					if ( !class_exists('SEO_URL') ){
							include_once(DIR_WS_CLASSES . 'seo.class.php');
					}
					global $languages_id;
					$seo_urls = new SEO_URL($languages_id);
			}
	return $seo_urls->href_link($page, $parameters, $connection, $add_session_id);
 }
} else { //run original code
// The HTML href link wrapper function
 function tep_href_link($page = '', $parameters = '', $connection = 'NONSSL', $add_session_id = true, $search_engine_safe = true) {
global $request_type, $session_started, $SID;

if (!tep_not_null($page)) {
  die('<br><br><font color="#ff0000"><b>Error!</b></font><br><br><b>Unable to determine the page link!<br><br>');
}

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('<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 (tep_not_null($parameters)) {
  $link .= $page . '?' . tep_output_string($parameters);
  $separator = '&';
} else {
  $link .= $page;
  $separator = '?';
}

while ( (substr($link, -1) == '&') || (substr($link, -1) == '?') ) $link = substr($link, 0, -1);

// Add the session ID when moving from different HTTP and HTTPS servers, or when SID is defined
if ( ($add_session_id == true) && ($session_started == true) && (SESSION_FORCE_COOKIE_USE == 'False') ) {
  if (tep_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 = tep_session_name() . '=' . tep_session_id();
	}
  }
}

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 = '?';
}

if (isset($_sid)) {
  $link .= $separator . $_sid;
}

return $link;
 }
}

 

then error occur, which i can't use buy now button. If i remove and not replace then the SEO seem to work ok. any idea why and what is this for? Thanks.

Share this post


Link to post
Share on other sites

Anyone know what would cause the rewrite to look like this if you're in a category?

/catalog/index.php?catalog=index.php

It's also not prepending the cId if depth is pId. Any ideas?


David

Share this post


Link to post
Share on other sites

Hy guys,

 

 

I've installed this contribution but when I make the necessary changes in the .htaccess all the system crashes and the site does not works! :o

 

There is a special method to modify this file, I use windows but on an UNIX server.

 

THANK YOU, hope to hearing from you soon...

 

 

SImone

WineStoreOnLine


Fine Italian Wines

Share this post


Link to post
Share on other sites

Hello all,

 

I've just installed the very promising Ultimate SEO, it went well without a hitch but I've a couple of questions:

 

1. will this work on localhost? My site resides here htdocs/application_sites/client_six/catalog. It's changing the URL and making the html bit but getting a 404 when clicking the link? My .htaccess resides in the catalog dir and I've specified \catalog\ as the rewritebase. All other pages ok BTW. But I thought that this may be because I'm using it on my local machine, would this be the case do you think?

 

2. where in admin can I switch off and on SEO?

 

Thanks

 

Sarah

Share this post


Link to post
Share on other sites

Hi There

 

Just installed Ultimate SEO URLs, but when trying to run my site i get

 

Server Requirement Error: register_globals is disabled in your PHP configuration. This can be enabled in your php.ini configuration file or in the .htaccess file in your catalog directory.

 

Which never happened before.

 

Anyone else had this problem?

 

Thanks

Share this post


Link to post
Share on other sites

Hello all.

 

I did what ever i was told thru the install file

now when i want to update a product in the admin section i get the following error.

1146 - Table 'db138094422.cache' doesn't exist

 

DELETE FROM cache WHERE cache_name LIKE '%seo_urls%'

 

[TEP STOP]

 

Also i dont see in the admin section anything about the SEO URL'S...

 

Please help i am ready to work with anyone out there.....

 

Thanks in advance

Share this post


Link to post
Share on other sites
Hy guys,

I've installed this contribution but when I make the necessary changes in the .htaccess all the system crashes and the site does not works! :o

 

There is a special method to modify this file, I use windows but on an UNIX server.

 

THANK YOU, hope to hearing from you soon...

SImone

WineStoreOnLine

 

The system crashes? What specific error message(s) do you see? On which page(s)?

 

I did not understand your comment about Windows and UNIX. Is your webserver IIS? Is it Apache? What operating system is it running on?

 

-jared

Share this post


Link to post
Share on other sites

Hello all,

 

I've just installed the very promising Ultimate SEO, it went well without a hitch but I've a couple of questions:

 

1. will this work on localhost? My site resides here htdocs/application_sites/client_six/catalog. It's changing the URL and making the html bit but getting a 404 when clicking the link? My .htaccess resides in the catalog dir and I've specified \catalog\ as the rewritebase. All other pages ok BTW. But I thought that this may be because I'm using it on my local machine, would this be the case do you think?

 

2. where in admin can I switch off and on SEO?

 

Thanks

 

Sarah

 

Anyone got an opinion on this??

Share this post


Link to post
Share on other sites
Hy guys,

I've installed this contribution but when I make the necessary changes in the .htaccess all the system crashes and the site does not works!

 

There is a special method to modify this file, I use windows but on an UNIX server.

 

THANK YOU, hope to hearing from you soon...

SImone

WineStoreOnLine

 

 

 

The system crashes? What specific error message(s) do you see? On which page(s)?

 

I did not understand your comment about Windows and UNIX. Is your webserver IIS? Is it Apache? What operating system is it running on?

 

-jared

 

When I paste the code from the notepad to the .htaccess file the error displayed in the page is:

 

Internal Server Error 500

 

and all the site crashes!

 

Help me please!

 

Hope to hearing from you soon


Fine Italian Wines

Share this post


Link to post
Share on other sites
Hello all,

 

I've just installed the very promising Ultimate SEO, it went well without a hitch but I've a couple of questions:

 

1. will this work on localhost? My site resides here htdocs/application_sites/client_six/catalog. It's changing the URL and making the html bit but getting a 404 when clicking the link? My .htaccess resides in the catalog dir and I've specified \catalog\ as the rewritebase. All other pages ok BTW. But I thought that this may be because I'm using it on my local machine, would this be the case do you think?

 

2. where in admin can I switch off and on SEO?

 

Thanks

 

Sarah

 

Anyone got an opinion on this??

 

Sorry to ask this again, but can anyone answer this, particulary whether this contrib will work on my local machine. I'm wondering whether these 404 (product not found) are a resuly of my running locally?? I'd relally appriciate any comment on this. Thanks. Sarah

Share this post


Link to post
Share on other sites

Have you tried it? ;)

 

It should work fine on your local machine, as long as osCommerce will run on your local machine.

 

I believe that the most recent 2.1d posted on has a feature to switch on/off the SEO features. Other than that, some other methods have been posted to this thread a few pages back.

 

If you continue to have problems, I suggest turning off most of the features, specifically caching, and seeing if that resolves any of the issues.

 

-jared

Edited by jcall

Share this post


Link to post
Share on other sites
Have you tried it? ;)

 

It should work fine on your local machine, as long as osCommerce will run on your local machine.

 

I believe that the most recent 2.1d posted on has a feature to switch on/off the SEO features. Other than that, some other methods have been posted to this thread a few pages back.

 

If you continue to have problems, I suggest turning off most of the features, specifically caching, and seeing if that resolves any of the issues.

 

-jared

 

 

Thanks and yes I have installed and tried it locally. OSC in itself works fine but after installing this contrip, specifically 2.1c (and d) I am getting the 404 page not found. The links on have changed ok but I think it's my .htaccess that giving me trouble. I think I'm a bit confused about the RewiriteBase/catalog/ bit. The installation docs differentiate between the store located in a directory as opposed to the root. CAn you clarify this (I appologise if this is fundemental!!)

 

The contents of my file are:

 

#

# 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>

 

# 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 turning off most of the features as you suggested but no joy, still the 'Not Found'!

 

Thanks anyway, Sarah

Share this post


Link to post
Share on other sites

Hi guys,

I have successfully installed the contribution SEO URLs by chemo but when i apply changes to my .htaccess file all the site stops working and gives an Iternal Server Error 500 :o

Could you please help me or could you post your working .htaccess file?

I use windows Xp but on an UNIX server and my root directory is / (I do not use catalog)

 

Thank you and hope to hearing from you soon...

 

Best Regards

Simone Mainardi


Fine Italian Wines

Share this post


Link to post
Share on other sites
Warning: call_user_func(tep_reset_cache_data_seo_urls): First argument is expected to be a valid callback in /.../admin/includes/functions/general.php on line 1473

 

I am getting this same message at the top of my SEO configuration page. My category and product URL's look correct, but pages such as shipping, about us, etc still have a .php extention. I followed your suggestion to move the defines to a new location. In fact, I couldn't find where they had be defined in application_top.php previously. Even after adding these defines, I still get the error message and I still have a problem with information pages having a .php extension. Are these two problems related?

 

Thanks,

Hugh

Share this post


Link to post
Share on other sites
Hi guys,

I have successfully installed the contribution SEO URLs by chemo but when i apply changes to my .htaccess file all the site stops working and gives an Iternal Server Error 500

Could you please help me or could you post your working .htaccess file?

I use windows Xp but on an UNIX server and my root directory is / (I do not use catalog)

 

Thank you and hope to hearing from you soon...

 

Best Regards

Simone Mainardi

 

ALL OK, B)

 

Simply cut the

+FollowSymLinks

string


Fine Italian Wines

Share this post


Link to post
Share on other sites

I'm getting a bit desperate now. Can anyone help as I've stil got the

 

"Not Found

The requested URL /catalog/textures-c-32.html was not found on this server."

 

I've made sure that I've installed the contrib properly and followed the instructions, I've also made sure that apache is configured with its rewite enabled and made the .htaccess file, and tried most of the setting in admin to see what effect they had and read through every post in this thread but still no go. I don't really know where to go with this.

 

Sarah

Share this post


Link to post
Share on other sites

Hello,

 

SEO urls are great! I'm very happy with this one, I just wonder I saw that a lot of links visited by bot look like this one

example-11.html?osCsid=9dcc3508dc657934220bb31206afd0b9

 

I don't like ?osCsid=9dcc3508dc657934220bb31206afd0b9 is there any way to get rid of it?

or googlebot cuts it off?

 

I would be grateful for opinions, Thank You and Merry X-mas

Share this post


Link to post
Share on other sites

Before I dig too deep into why this isn't working ok for me is this contribution compatable to the sts_template system?

 

I've installed the SEO URLs on many other sites but this one isn't working right and I was wondering if the sts_template code was overwriting something.

 

Thanks,

Justin

Share this post


Link to post
Share on other sites

I'm using the latest Ultimate SEO and it's been working just fine. However, I'm not trying to use FaqDesk and it's presenting a problem. Most links work just fine, but the index (the entry page to the faq) doesn't. For example:

http://honeyrunapiaries.com/store/faqdesk_...x.php?faqPath=1 (works)

http://honeyrunapiaries.com/store/faqdesk_...x.php/faqPath/1 (doesn't work)

but the actual articles do work:

http://honeyrunapiaries.com/store/faqdesk_.../1/faqdesk_id/4 (works)

 

Anyone else run into this? Any fix or idea what I should be looking for?

 

-Tim

Share this post


Link to post
Share on other sites

It's not a complete fix, but I did manage to make it work by disableing the SEO for just faqdesk_index.php by adding the following line to seo.class.php (around line 551):

if ( defined('FILENAME_FAQDESK_INDEX') ) $seo_pages[] = FILENAME_FAQDESK_INDEX;

 

-Tim

Share this post


Link to post
Share on other sites

I have a Problem With the installation of Ultimate SEO (the very first version ever built), I was installing this on my site www.onlyfantasy.com which is running OSCOMMERCE 2.2 MS2. When i bought this site it only had very few modules added to it and few additions. Therefore virtually like a clean install, however for some reason the SEO urls will not activate

 

The SEO urls appears in my admin section however when i got to enable and select rewrite, i go to load the pages and they aren't actually been rewritten with the correct URLS.

 

Hence i have ended up with www.onlyfantasy.com/blakslfjsdkfljaslfjklsfsd instead of www.onlyfantasy.com/product22_3.html for example

 

can anyone see straight off why the script might not be firing? I can give you ftp access if it helps anyone fix the problem.

Share this post


Link to post
Share on other sites

Hi,

 

I installed this contibution but it just does not work. When I hover over any link it looks ok (product name and category name replaced the id), but when i click on the link i get Error 404.

 

I tried the .htaccess with and without "Options +FollowSymLinks".

 

I turned off all my caching. It still does not work.

 

Any ideas?

 

Shlomi

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

×