nidhi Posted February 17, 2008 Posted February 17, 2008 Hello everyone, I am new to this forum and new to oscommerce. Most of the people develop the site, rewrite the URLs and then go for seo. But i need to work on a site which is already doing well at google. The site's pages are all html. Main category pages are like category1.html, category2.html and so on. Product pages are named after product pages e.g. 1023.html. Now we need to make the site in oscommerce and still not lose all those pages. How is it possible to convert the site in oscommerce and name all the category pages like category1.html and so on and product pages with their product codes like 1023.html. I thank you all for your time.
♥FWR Media Posted February 17, 2008 Posted February 17, 2008 Difficult. The only way I can think to do it is to use ULTIMATE SEO URLS 2.1d you will see a list of 3 and it's the top of the 3 you may want. With this particular one I believe you can set the seo url for each category/product individually. Uploaded 29th November 2006 by Yesudo called .. Ultimate SEO URLs - 2.1d with optional Admin settable Product and Category URLs Ultimate SEO Urls 5 PRO - Multi Language Modern, Powerful SEO Urls KissMT Dynamic SEO Meta & Canonical Header Tags KissER Error Handling and Debugging KissIT Image Thumbnailer Security Pro - Querystring protection against hackers ( a KISS contribution ) If you found my post useful please click the "Like This" button to the right. Please only PM me for paid work.
♥toyicebear Posted February 17, 2008 Posted February 17, 2008 You probably have to use SEO-G if you want the mentioned url format Basics for osC 2.2 Design - Basics for Design V2.3+ - Seo & Sef Url's - Meta Tags for Your osC Shop - Steps to prevent Fraud... - MS3 and Team News... - SEO, Meta Tags, SEF Urls and osCommerce - Commercial Support Inquiries - OSC 2.3+ How To To see what more i can do for you check out my profile [click here]
nidhi Posted February 18, 2008 Author Posted February 18, 2008 I am sorry if i have not explained it properly. I need categry pages to be named as categoryname.html and product pages to be named as productcode.html. We will ensure that category names and product codes match the previous URLs.
♥FWR Media Posted February 18, 2008 Posted February 18, 2008 I am sorry if i have not explained it properly. I need categry pages to be named as categoryname.html and product pages to be named as productcode.html. We will ensure that category names and product codes match the previous URLs. Well here's some code that seems to work .. no guarantees though. (stock osC URLs only) catalog .htaccess Options +FollowSymLinks RewriteEngine On RewriteBase /catalog/ RewriteRule ^(.*).html$ index.php$2?%{QUERY_STRING} RewriteBase / for a root install catalog/includes/application_top.php Find .. // set the application parameters $configuration_query = tep_db_query('select configuration_key as cfgKey, configuration_value as cfgValue from ' . TABLE_CONFIGURATION); while ($configuration = tep_db_fetch_array($configuration_query)) { define($configuration['cfgKey'], $configuration['cfgValue']); } Add below: - if (false !== strpos($_SERVER['REQUEST_URI'], '.html')) include('includes/functions/urlconvert.php'); //FWR Media Find .. require(DIR_WS_LANGUAGES . $language . '.php'); Add below: - ( false !== strpos($_SERVER['REQUEST_URI'], '.html') ? UrlConvert() : NULL ); //FWR test Put the following into a php file .. call it urlconvert.php and save it to catalog/includes/functions/ <?php function UrlConvert() { global $HTTP_GET_VARS, $cPath_array; $find_parts = str_replace( '/', '', strrchr($_SERVER['REQUEST_URI'], '/') ); $querystring = strrchr($find_parts, '?'); $remove = array('.html', $querystring); $name = urldecode(str_replace($remove, '', $find_parts)); $is_category = false; $is_product = false; $cat_result = tep_db_query("SELECT categories_id FROM categories_description WHERE categories_name = '$name'"); if ($cat_id = tep_db_fetch_array($cat_result)) $is_category = true; else if ($is_category === false) { $prod_result = tep_db_query("SELECT products_id FROM products_description WHERE products_name = '$name'"); if ($prod_id = tep_db_fetch_array($prod_result)) $is_product = true; } if ( $is_category === false && $is_product === false) die('can\'t find this one'); else if ($is_category === true) { $cat_path = array(); $cat_path[] = $cat_id['categories_id']; $has_parent = fwr_has_parent($cat_id['categories_id']); if ( false !== $has_parent ) { if (false !== $has_parent) $cat_path[] = $has_parent; $has_parent = fwr_has_parent($has_parent); if (false !== $has_parent) $cat_path[] = $has_parent; $pathtomod = array_reverse($cat_path); for ($i=0; $i<count($pathtomod); $i++) if ( $i == (count($pathtomod)-1)) $UrlCcPath .= $pathtomod[$i]; else $UrlCcPath .= $pathtomod[$i] . '_'; } else $UrlCcPath = $cat_id['categories_id']; $redirect = tep_href_link(FILENAME_DEFAULT, 'cPath=' . $UrlCcPath); header("HTTP/1.0 301 Moved Permanently"); // redirect to the good version header("Location: $redirect"); // 301 redirect exit; } else if ($is_product === true) { $redirect = tep_href_link(FILENAME_PRODUCT_INFO, 'cPath=' . tep_get_product_path($prod_id['products_id']) . '&products_id=' . $prod_id['products_id']); header("HTTP/1.0 301 Moved Permanently"); // redirect to the good version header("Location: $redirect"); // 301 redirect exit; } else die('This shouldn\'t happen'); } function fwr_has_parent($cid) { $parent_result = tep_db_query("SELECT parent_id FROM categories WHERE categories_id = '$cid'"); if ( $has_parent = @tep_db_fetch_array($parent_result) ) if ( $has_parent['parent_id'] != '0' ) return $has_parent['parent_id']; else return false; } ?> Very raw, I haven't cleaned it up after getting it basically to work but should give you some ideas. Obviously it is vital that the productname.html .. productname must EXACTLY match the name of the category or product. Ultimate SEO Urls 5 PRO - Multi Language Modern, Powerful SEO Urls KissMT Dynamic SEO Meta & Canonical Header Tags KissER Error Handling and Debugging KissIT Image Thumbnailer Security Pro - Querystring protection against hackers ( a KISS contribution ) If you found my post useful please click the "Like This" button to the right. Please only PM me for paid work.
nidhi Posted February 18, 2008 Author Posted February 18, 2008 Thanks a lot for your time and interest in my problem. I shall try this code.
satish Posted February 18, 2008 Posted February 18, 2008 Thanks a lot for your time and interest in my problem. I shall try this code. SEO-G by enigma allows You to specify URL name. Go for it.I think it has been suggested two three posts UP I too support that post. Plus its far superior to any other seo code. Satish Ask/Skype for Free osCommerce value addon/SEO suggestion tips for your site. Check My About US For who am I and what My company does.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.