Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

ULTIMATE SEO URLs avoid google penalties


FWR Media

Recommended Posts

2-2.2e is still producing problems and until Chemo shows up it's likely to stay that way.

 

The biggest problems that people are facing is duplication penalties from the Google and the other bots where ...

 

 

www.mysite.com/my-great-product-p-362.html ## Correct URL

 

Can be accessed by ...

 

www.mysite.com/myloadofabsoluterubbish-p-362.html ## Not so correct

 

2-2.2e addresses this problem but sadly adds its own making the matter worse .. e.g. with google rejecting redirecting sitemaps for example.

 

The solution (Albeit a temporary one)

 

The file to use

 

Doesn't matter much if your mysql can use it I'd use the Nov 06 2.1d but if you use 2-2.2e comment out every line that starts with

 

$this->ValidateName($url,

 

So ..

 

//$this->ValidateName($url,

 

This effectively turns validation off.

 

Now the code:

 

application_top.php

 

Find ...

 

// Ultimate SEO URLs v2.1
	 include_once(DIR_WS_CLASSES . 'seo.class.php');
	 if ( !is_object($seo_urls) ){
		 $seo_urls = new SEO_URL($languages_id);
	 }

 

Add directly below: -

	 ################################################
 // fwrmedia.co.uk mod to check SEO link validity
 if ( strpos($_SERVER['REQUEST_URI'], '.html') ) { // Is it an SEO URL link
	( strpos($_SERVER['REQUEST_URI'], '-p-')   ? ($querytype = 'filename_product_info-products_id=' . $HTTP_GET_VARS['products_id']) :
	( strpos($_SERVER['REQUEST_URI'], '-c-')   ? ($querytype = 'filename_default-cPath=' . $HTTP_GET_VARS['cPath']) :
	( strpos($_SERVER['REQUEST_URI'], '-m-')   ? ($querytype = 'filename_default-manufacturers_id=' . $HTTP_GET_VARS['manufacturers_id']) :
	( strpos($_SERVER['REQUEST_URI'], '-pi-')  ? ($querytype = 'filename_popup_image-pID=' . $HTTP_GET_VARS['pID']) :
	( strpos($_SERVER['REQUEST_URI'], '-t-')   ? ($querytype = 'filename_articles-tPath=' . $HTTP_GET_VARS['pID']) :
	( strpos($_SERVER['REQUEST_URI'], '-a-')   ? ($querytype = 'filename_article_info-articles_id=' . $HTTP_GET_VARS['articles_id']) :
	( strpos($_SERVER['REQUEST_URI'], '-pr-')  ? ($querytype = 'filename_product_reviews-products_id=' . $HTTP_GET_VARS['products_id']) :
	( strpos($_SERVER['REQUEST_URI'], '-pri-') ? ($querytype = 'filename_product_reviews_info-products_id=' . $HTTP_GET_VARS['products_id']) :
	( strpos($_SERVER['REQUEST_URI'], '-prw-') ? ($querytype = 'filename_product_reviews_write-products_id=' . $HTTP_GET_VARS['products_id']) :
	( strpos($_SERVER['REQUEST_URI'], '-i-')   ? ($querytype = 'filename_information-info_id=' . $HTTP_GET_VARS['info_id']) :
	false ))))))))) );
 $validate_array = explode('-', $querytype); // Two part array made up of e.g. FILENAME_DEFAULT and products_id=X
 $seolink = tep_href_link(constant(strtoupper($validate_array[0])), $validate_array[1]);
	   if ( HTTP_SERVER . $_SERVER['REQUEST_URI'] != $seolink ) {
	   header("HTTP/1.0 301 Moved Permanently");
	   header("Location: $seolink"); // 301 redirect
	   exit;
	   }
 unset( $querytype, $seolink, $validate_array );
 }
 ################################################
 // END fwrmedia.co.uk mod to check SEO link validity

 

That's it!!! as you can see there are no queries (unless the links are updating)

 

Go to an seo url and replace the product wording in your brower with something ridiculous

 

e.g as mentioned before ..

 

 

www.mysite.com/my-great-product-p-362.html ## Correct URL

 

 

Put in your browser something like ...

 

www.mysite.com/myloadofabsoluterubbish-p-362.html ## Not so correct

 

When you put in the myloadofabsoluterubbish the link should automatically 301 redirect to the correct URL.

 

This will keep Google and your rankings happy.

 

Rob

Edited by Babygurgles
Link to comment
Share on other sites

Tiny modification for paging in pages that need to use split_page_results

 

################################################
// fwrmedia.co.uk mod to check SEO link validity
if ( strpos($_SERVER['REQUEST_URI'], '.html') ) {
  $seo_request = preg_replace("/([&]|)osCsid=.{32}/", "", $_SERVER['REQUEST_URI']);
  $added_uri = strstr  ( $seo_request, '?' );
  $seo_request = str_replace($added_uri, '', $seo_request);
  ( strpos($_SERVER['REQUEST_URI'], '-p-')   ? ($querytype = 'filename_product_info-products_id=' . $HTTP_GET_VARS['products_id']) :
  ( strpos($_SERVER['REQUEST_URI'], '-c-')   ? ($querytype = 'filename_default-cPath=' . $HTTP_GET_VARS['cPath']) :
  ( strpos($_SERVER['REQUEST_URI'], '-m-')   ? ($querytype = 'filename_default-manufacturers_id=' . $HTTP_GET_VARS['manufacturers_id']) :
  ( strpos($_SERVER['REQUEST_URI'], '-pi-')  ? ($querytype = 'filename_popup_image-pID=' . $HTTP_GET_VARS['pID']) :
  ( strpos($_SERVER['REQUEST_URI'], '-t-')   ? ($querytype = 'filename_articles-tPath=' . $HTTP_GET_VARS['pID']) :
  ( strpos($_SERVER['REQUEST_URI'], '-a-')   ? ($querytype = 'filename_article_info-articles_id=' . $HTTP_GET_VARS['articles_id']) :
  ( strpos($_SERVER['REQUEST_URI'], '-pr-')  ? ($querytype = 'filename_product_reviews-products_id=' . $HTTP_GET_VARS['products_id']) :
  ( strpos($_SERVER['REQUEST_URI'], '-pri-') ? ($querytype = 'filename_product_reviews_info-products_id=' . $HTTP_GET_VARS['products_id']) :
  ( strpos($_SERVER['REQUEST_URI'], '-prw-') ? ($querytype = 'filename_product_reviews_write-products_id=' . $HTTP_GET_VARS['products_id']) :
  ( strpos($_SERVER['REQUEST_URI'], '-i-')   ? ($querytype = 'filename_information-info_id=' . $HTTP_GET_VARS['info_id']) :
  false ))))))))) );
  $validate_array = explode('-', $querytype);
  $link = tep_href_link(constant(strtoupper($validate_array[0])), $validate_array[1]) . $added_uri;
	 if ( HTTP_SERVER . $_SERVER['REQUEST_URI'] != $link ) {
		header("HTTP/1.0 301 Moved Permanently");
		header("Location: $link . "); // redirect...bye bye
	 }
}
################################################
// END fwrmedia.co.uk mod to check SEO link validity

Link to comment
Share on other sites

Aggggh typo city ..

 

################################################
// fwrmedia.co.uk mod to check SEO link validity
if ( strpos($_SERVER['REQUEST_URI'], '.html') ) {
  $seo_request = preg_replace("/([&]|)osCsid=.{32}/", "", $_SERVER['REQUEST_URI']);
  $added_uri = strstr  ( $seo_request, '?' );
  ( strpos($_SERVER['REQUEST_URI'], '-p-')   ? ($querytype = 'filename_product_info-products_id=' . $HTTP_GET_VARS['products_id']) :
  ( strpos($_SERVER['REQUEST_URI'], '-c-')   ? ($querytype = 'filename_default-cPath=' . $HTTP_GET_VARS['cPath']) :
  ( strpos($_SERVER['REQUEST_URI'], '-m-')   ? ($querytype = 'filename_default-manufacturers_id=' . $HTTP_GET_VARS['manufacturers_id']) :
  ( strpos($_SERVER['REQUEST_URI'], '-pi-')  ? ($querytype = 'filename_popup_image-pID=' . $HTTP_GET_VARS['pID']) :
  ( strpos($_SERVER['REQUEST_URI'], '-t-')   ? ($querytype = 'filename_articles-tPath=' . $HTTP_GET_VARS['pID']) :
  ( strpos($_SERVER['REQUEST_URI'], '-a-')   ? ($querytype = 'filename_article_info-articles_id=' . $HTTP_GET_VARS['articles_id']) :
  ( strpos($_SERVER['REQUEST_URI'], '-pr-')  ? ($querytype = 'filename_product_reviews-products_id=' . $HTTP_GET_VARS['products_id']) :
  ( strpos($_SERVER['REQUEST_URI'], '-pri-') ? ($querytype = 'filename_product_reviews_info-products_id=' . $HTTP_GET_VARS['products_id']) :
  ( strpos($_SERVER['REQUEST_URI'], '-prw-') ? ($querytype = 'filename_product_reviews_write-products_id=' . $HTTP_GET_VARS['products_id']) :
  ( strpos($_SERVER['REQUEST_URI'], '-i-')   ? ($querytype = 'filename_information-info_id=' . $HTTP_GET_VARS['info_id']) :
  false ))))))))) );
  $validate_array = explode('-', $querytype);
  $link = tep_href_link(constant(strtoupper($validate_array[0])), $validate_array[1]) . $added_uri;
	 if ( HTTP_SERVER . $_SERVER['REQUEST_URI'] != $link ) {
		header("HTTP/1.0 301 Moved Permanently");
		header("Location: $link"); // 301 redirect
	 }
}
################################################
// END fwrmedia.co.uk mod to check SEO link validity

Link to comment
Share on other sites

New version:

 

Should work with all versions of ultimate seo urls (Using -c- -m- etc)

 

Corrects bad links and 301 redirects to good link. (Good practice as Google will update its index acordingly)

 

Now 404 redirects to index.php if the page no longer exists (e.g. a deleted category or product etc.).

 

Less code in application_top.php (Moves some to includes/functions/general.php as a tep function)

 

### instructions ###

 

catalog/includes/application_top.php

 

Find ...

 

 

// Ultimate SEO URLs v2.1
	 include_once(DIR_WS_CLASSES . 'seo.class.php');
	 if ( !is_object($seo_urls) ){
		 $seo_urls = new SEO_URL($languages_id);
	 }

 

 

Add immediately below: -

 

 

 

################################################
// fwrmedia.co.uk mod to check SEO link validity
if ( is_object($seo_urls) && strpos($_SERVER['REQUEST_URI'], '.html') ) { // SEO URLS is active and there is .html in the querystring
tep_validate_seo_urls();
 }
################################################
// END fwrmedia.co.uk mod to check SEO link validity

 

 

catalog/includes/functions/general.php

 

Add immediately above the final closing ?> at the bottom of the file

 

function tep_validate_seo_urls() {
 global $validate_array, $HTTP_GET_VARS;
################################################
// fwrmedia.co.uk mod to check SEO link validity
  $seo_request = preg_replace("/([&]|)osCsid=.{32}/", "", $_SERVER['REQUEST_URI']); // Lose the osCsid
  $added_uri = strstr  ( $seo_request, '?' ); // any extras in the querystring? like page=x&sort=y (split_page_results)
  ( strpos($_SERVER['REQUEST_URI'], '-p-')   ? ($querytype = 'filename_product_info-products_id=' . $HTTP_GET_VARS['products_id']) :
  ( strpos($_SERVER['REQUEST_URI'], '-c-')   ? ($querytype = 'filename_default-cPath=' . $HTTP_GET_VARS['cPath']) :
  ( strpos($_SERVER['REQUEST_URI'], '-m-')   ? ($querytype = 'filename_default-manufacturers_id=' . $HTTP_GET_VARS['manufacturers_id']) :
  ( strpos($_SERVER['REQUEST_URI'], '-pi-')  ? ($querytype = 'filename_popup_image-pID=' . $HTTP_GET_VARS['pID']) :
  ( strpos($_SERVER['REQUEST_URI'], '-t-')   ? ($querytype = 'filename_articles-tPath=' . $HTTP_GET_VARS['pID']) :
  ( strpos($_SERVER['REQUEST_URI'], '-a-')   ? ($querytype = 'filename_article_info-articles_id=' . $HTTP_GET_VARS['articles_id']) :
  ( strpos($_SERVER['REQUEST_URI'], '-pr-')  ? ($querytype = 'filename_product_reviews-products_id=' . $HTTP_GET_VARS['products_id']) :
  ( strpos($_SERVER['REQUEST_URI'], '-pri-') ? ($querytype = 'filename_product_reviews_info-products_id=' . $HTTP_GET_VARS['products_id']) :
  ( strpos($_SERVER['REQUEST_URI'], '-prw-') ? ($querytype = 'filename_product_reviews_write-products_id=' . $HTTP_GET_VARS['products_id']) :
  ( strpos($_SERVER['REQUEST_URI'], '-i-')   ? ($querytype = 'filename_information-info_id=' . $HTTP_GET_VARS['info_id']) :
  false ))))))))) );
  $validate_array = explode('-', $querytype);
  $linkreturned = tep_href_link(constant(strtoupper($validate_array[0])), $validate_array[1]) . $added_uri; // Get seo.class.php to make us a brand new url
  $linktest = str_replace(HTTP_SERVER . '/', '', $linkreturned); // Pair the url down to the querystring
		 if (strpos($linktest, '-') === 0) { // If the link returned by seo.class.php has no text mysite.com/-c-xxx.html
			$dohome = HTTP_SERVER;			  // It means that the page no longer exists (assuming the class is working)
			header("HTTP/1.0 404 Not Found");   // Set header 404 Not Found
			header("Location: $dohome"); // .. 404 redirect to index.php .. and never come back!!!
			exit;
		 }
		 if ( HTTP_SERVER . $_SERVER['REQUEST_URI'] != $linkreturned ) { // Link looks bad so 301
			header("HTTP/1.0 301 Moved Permanently");					// redirect to the good version
			header("Location: $linkreturned"); // 301 redirect
			exit;
	 }
################################################
// END fwrmedia.co.uk mod to check SEO link validity
}

 

 

All done.

Edited by Babygurgles
Link to comment
Share on other sites

Help please.

 

I have this

// Ultimate SEO URLs v2.1
 if ((!defined(SEO_ENABLED)) || (SEO_ENABLED == 'true')) {
include_once(DIR_WS_CLASSES . 'seo.class.php');
if ( !is_object($seo_urls) ){
  $seo_urls = new SEO_URL($languages_id);
}
 }

 

I did post # 7

 

But the second page of my categories stil dosent open :(

Edited by Pooya
Link to comment
Share on other sites

Help please.

 

I have this

// Ultimate SEO URLs v2.1
 if ((!defined(SEO_ENABLED)) || (SEO_ENABLED == 'true')) {
include_once(DIR_WS_CLASSES . 'seo.class.php');
if ( !is_object($seo_urls) ){
  $seo_urls = new SEO_URL($languages_id);
}
 }

 

I did post # 7

 

But the second page of my categories stil dosent open :(

 

Sorry I don't get what you mean.

Link to comment
Share on other sites

Everything else of my seo works. Except for the category second page :(

 

I did the post #5 but no luck for me :( am i missing something ?

 

Site link?

Link to comment
Share on other sites

http://www.vmart.pk .. I have seo turned off... Should i enable ?

 

Yup but normal links shouldn't work if SEO is enabled.

Link to comment
Share on other sites

New version:

 

Should work with all versions of ultimate seo urls (Using -c- -m- etc)

 

Corrects bad links and 301 redirects to good link. (Good practice as Google will update its index acordingly)

 

Now 404 redirects to index.php if the page no longer exists (e.g. a deleted category or product etc.).

 

Less code in application_top.php (Moves some to includes/functions/general.php as a tep function)

 

### instructions ###

 

catalog/includes/application_top.php

 

Find ...

// Ultimate SEO URLs v2.1
	 include_once(DIR_WS_CLASSES . 'seo.class.php');
	 if ( !is_object($seo_urls) ){
		 $seo_urls = new SEO_URL($languages_id);
	 }

Add immediately below: -

################################################
// fwrmedia.co.uk mod to check SEO link validity
if ( is_object($seo_urls) && strpos($_SERVER['REQUEST_URI'], '.html') ) { // SEO URLS is active and there is .html in the querystring
tep_validate_seo_urls();
 }
################################################
// END fwrmedia.co.uk mod to check SEO link validity

catalog/includes/functions/general.php

 

Add immediately above the final closing ?> at the bottom of the file

 

function tep_validate_seo_urls() {
 global $validate_array, $HTTP_GET_VARS;
################################################
// fwrmedia.co.uk mod to check SEO link validity
  $seo_request = preg_replace("/([&]|)osCsid=.{32}/", "", $_SERVER['REQUEST_URI']); // Lose the osCsid
  $added_uri = strstr  ( $seo_request, '?' ); // any extras in the querystring? like page=x&sort=y (split_page_results)
  ( strpos($_SERVER['REQUEST_URI'], '-p-')   ? ($querytype = 'filename_product_info-products_id=' . $HTTP_GET_VARS['products_id']) :
  ( strpos($_SERVER['REQUEST_URI'], '-c-')   ? ($querytype = 'filename_default-cPath=' . $HTTP_GET_VARS['cPath']) :
  ( strpos($_SERVER['REQUEST_URI'], '-m-')   ? ($querytype = 'filename_default-manufacturers_id=' . $HTTP_GET_VARS['manufacturers_id']) :
  ( strpos($_SERVER['REQUEST_URI'], '-pi-')  ? ($querytype = 'filename_popup_image-pID=' . $HTTP_GET_VARS['pID']) :
  ( strpos($_SERVER['REQUEST_URI'], '-t-')   ? ($querytype = 'filename_articles-tPath=' . $HTTP_GET_VARS['pID']) :
  ( strpos($_SERVER['REQUEST_URI'], '-a-')   ? ($querytype = 'filename_article_info-articles_id=' . $HTTP_GET_VARS['articles_id']) :
  ( strpos($_SERVER['REQUEST_URI'], '-pr-')  ? ($querytype = 'filename_product_reviews-products_id=' . $HTTP_GET_VARS['products_id']) :
  ( strpos($_SERVER['REQUEST_URI'], '-pri-') ? ($querytype = 'filename_product_reviews_info-products_id=' . $HTTP_GET_VARS['products_id']) :
  ( strpos($_SERVER['REQUEST_URI'], '-prw-') ? ($querytype = 'filename_product_reviews_write-products_id=' . $HTTP_GET_VARS['products_id']) :
  ( strpos($_SERVER['REQUEST_URI'], '-i-')   ? ($querytype = 'filename_information-info_id=' . $HTTP_GET_VARS['info_id']) :
  false ))))))))) );
  $validate_array = explode('-', $querytype);
  $linkreturned = tep_href_link(constant(strtoupper($validate_array[0])), $validate_array[1]) . $added_uri; // Get seo.class.php to make us a brand new url
  $linktest = str_replace(HTTP_SERVER . '/', '', $linkreturned); // Pair the url down to the querystring
		 if (strpos($linktest, '-') === 0) { // If the link returned by seo.class.php has no text mysite.com/-c-xxx.html
			$dohome = HTTP_SERVER;			  // It means that the page no longer exists (assuming the class is working)
			header("HTTP/1.0 404 Not Found");   // Set header 404 Not Found
			header("Location: $dohome"); // .. 404 redirect to index.php .. and never come back!!!
			exit;
		 }
		 if ( HTTP_SERVER . $_SERVER['REQUEST_URI'] != $linkreturned ) { // Link looks bad so 301
			header("HTTP/1.0 301 Moved Permanently");					// redirect to the good version
			header("Location: $linkreturned"); // 301 redirect
			exit;
	 }
################################################
// END fwrmedia.co.uk mod to check SEO link validity
}

All done.

 

i still have 2 bugs, 1st http://www.domain.co.uk/catalog/hid-xenon-bulb-c-35.html shows http://www.domain.co.uk/catalog/xenon-bulb-c-35.html in category links on left side but directs to correct

 

2nd if i http://www.domain.co.uk/catalog/hid-xenon-...c-35555555.html then rest of the links have http://www.domain.co.uk/catalog/hid-xenon-...3555555_35.html <---left side category links

Link to comment
Share on other sites

1)

i still have 2 bugs, 1st http://www.domain.co.uk/catalog/hid-xenon-bulb-c-35.html shows http://www.domain.co.uk/catalog/xenon-bulb-c-35.html in category links on left side but directs to correct

 

Your categories are cached .. reset the cache.

 

2)

 

Havent got a clue what you mean.

Link to comment
Share on other sites

1)

Your categories are cached .. reset the cache.

 

2)

Havent got a clue what you mean.

 

 

I did reset it, i'll drop cache in myphp.

 

2) if i manually edit my link http://www.domain.co.uk/catalog/led-bulbs-c-22.html to http://www.domain.co.uk/catalog/led-bulbs-c-25552.html it goes to http://www.domain.co.uk/catalog/-c-255552.html and then rest of the category links become http://www.domainco.uk/catalog/led-bulbs-c-255552_22.html

Link to comment
Share on other sites

Link to comment
Share on other sites

i sent u link, if u manually edit a link and then check the category links you will know what i mean, which seo_class are you using?

 

What version of PHP are you on?

Link to comment
Share on other sites

Ok i'd suggest you take my mod off until I can retest.

Link to comment
Share on other sites

i had the problem before your mod. the original install was 2.2e

 

GRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR!!!!!!!

 

 

That's an hour wasted!!

Link to comment
Share on other sites

GRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR!!!!!!!

That's an hour wasted!!

 

 

but your mod shows correct link for hid-xenon-bulb-c-35.html on address bar but in category it shows line missing"hid-" xenon-bulb-c-35.html

 

i'v dropped cache from my php

 

then

 

DELETE FROM configuration_group WHERE `configuration_group_title` LIKE '%SEO%'

 

 

CODE

DELETE FROM configuration WHERE `configuration_key` LIKE '%SEO%'

 

but still there :(

Link to comment
Share on other sites

but your mod shows correct link for hid-xenon-bulb-c-35.html on address bar but in category it shows line missing"hid-" xenon-bulb-c-35.html

 

i'v dropped cache from my php

 

then

 

DELETE FROM configuration_group WHERE `configuration_group_title` LIKE '%SEO%'

CODE

DELETE FROM configuration WHERE `configuration_key` LIKE '%SEO%'

 

but still there :(

 

Move your question to the correct support thread please.

Link to comment
Share on other sites

### Update ###

 

Just replace the function tep_validate_seo_urls() in catalog/includes/functions/general.php. Presuming you already have the code in place in application_top.php.

 

Changes: -

 

Now tested on PHP5 and with cookies off/not working. Extra code added to deal correctly with osCsid and also differing filepaths. Extra code added to protect/secure $_GET.

 

Tested on MS2.2, RC1, RC2

 

function tep_validate_seo_urls() {
global $HTTP_GET_VARS;
################################################
// fwrmedia.co.uk mod to check SEO link validity
$querystring = str_replace('?', '&', $_SERVER['REQUEST_URI']);
$qs_parts = explode('&', $querystring); // explode the querystring into an array
$count = count($qs_parts);
$added_uri = array();
$remove_nasties = array('%3C', '%3E', '<', '>', ':/', 'http', 'HTTP'); // We do tep_sanitize_string() later anyway
for ( $i=0; $i<$count; $i++ ) { // We don't want to introduce vulnerability do we :)
 switch($qs_parts[$i]) {
 case(false !== strpos($qs_parts[$i], '.html')):
 $core = $qs_parts[$i]; // Found the path
 break;
 case(false !== strpos($qs_parts[$i], 'osCsid')):
 $seo_sid = $qs_parts[$i]; // Found the osCsid
 break;
 default:
  $added_uri[] = str_replace($remove_nasties, '', $qs_parts[$i]); //  Found the additional querystring (e.g. &page=3&sort=2a from  split_page_results)
 }
}
( strpos($_SERVER['REQUEST_URI'], '-p-') ? ($querytype = 'filename_product_info-products_id=' . $HTTP_GET_VARS['products_id']) :
( strpos($_SERVER['REQUEST_URI'], '-c-') ? ($querytype = 'filename_default-cPath=' . $HTTP_GET_VARS['cPath']) :
(  strpos($_SERVER['REQUEST_URI'], '-m-') ? ($querytype =  'filename_default-manufacturers_id=' .  $HTTP_GET_VARS['manufacturers_id']) :
( strpos($_SERVER['REQUEST_URI'], '-pi-') ? ($querytype = 'filename_popup_image-pID=' . $HTTP_GET_VARS['pID']) :
( strpos($_SERVER['REQUEST_URI'], '-t-') ? ($querytype = 'filename_articles-tPath=' . $HTTP_GET_VARS['pID']) :
( strpos($_SERVER['REQUEST_URI'], '-a-') ? ($querytype = 'filename_article_info-articles_id=' . $HTTP_GET_VARS['articles_id']) :
(  strpos($_SERVER['REQUEST_URI'], '-pr-') ? ($querytype =  'filename_product_reviews-products_id=' .  $HTTP_GET_VARS['products_id']) :
( strpos($_SERVER['REQUEST_URI'],  '-pri-') ? ($querytype = 'filename_product_reviews_info-products_id=' .  $HTTP_GET_VARS['products_id']) :
( strpos($_SERVER['REQUEST_URI'],  '-prw-') ? ($querytype = 'filename_product_reviews_write-products_id='  . $HTTP_GET_VARS['products_id']) :
( strpos($_SERVER['REQUEST_URI'], '-i-') ? ($querytype = 'filename_information-info_id=' . $HTTP_GET_VARS['info_id']) :
false ))))))))) );
$validate_array = explode('-', $querytype);
$linkreturned = tep_href_link(constant(strtoupper($validate_array[0])), $validate_array[1]);
// Rebuild the extra querystring
( (strpos($linkreturned, '?') !== false) ? ($seperator = '&') : ($seperator = '?') ); // Is there an osCid on $linkreturned?
$count = count($added_uri); // Count the extra querystring items
for ($i=0; $i<$count; $i++)
if  ($i == 0) $linkreturned = $linkreturned . $seperator .  tep_sanitize_string($added_uri[$i]); //add the first using seperator ?  or &
else $linkreturned = $linkreturned . '&' . tep_sanitize_string($added_uri[$i]); // Just add "&" this time
$linkreturnedstripped = str_replace( strstr($linkreturned, '?'), '', $linkreturned);
$linktest = str_replace(HTTP_SERVER . DIR_WS_HTTP_CATALOG, '', $linkreturned); // Pair the url down to the querystring
if (strpos($linktest, '-') === 0) { // If the link returned by seo.class.php has no text mysite.com/-c-xxx.html
$dohome = tep_href_link(FILENAME_DEFAULT); // It means that the page no longer exists (assuming the class is working)
header("HTTP/1.0 404 Not Found"); // Set header 404 Not Found
header("Location: $dohome"); // .. 404 redirect to index.php .. and never come back!!!
exit;
} else if ( HTTP_SERVER . $core != $linkreturnedstripped ) { // Link looks bad so 301
header("HTTP/1.0 301 Moved Permanently"); // redirect to the good version
header("Location: $linkreturned"); // 301 redirect
exit;
}
################################################
// END fwrmedia.co.uk mod to check SEO link validity
}

Edited by Babygurgles
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...