Contributions
Ultimate SEO URLs
#################################
NOTE: Versions 2.1d and later of this contribution contained works under the "Open Public License" which is not compatible with the GNU General Public License and therefor had to be removed. Please check that further additions to this contribution package are LEGAL and are released under the GNU General Public License.
#################################
I am proud to announce the release of Ultimate SEO URLs for osCommerce-MS2.
This contribution builds on the cName & pName code to give an even more flexible, search engine friendly, and cross server compatible SEO URLs.
Once installed, Ultimate SEO URLs will give the store owner the choice of the v1.X style cName or new v2.X style static HTML file. This setting is incorporated into the admin control panel so can be toggled on, off, cName, or Rewrite at will.
This contribution will work for any store on any server. It is compatible with not only *NIX based servers but also Windows/IIS servers (although IIS is limited to cName).
In addition, this contribution is compatible with all other contributions by me including Page Cache (directions included in install package).
This release supports multiple languages, unlimited nested categories, and duplicates with ease.
Expand All / Collapse All
Ultimate SEO URLs v2.4
The last package for this contribution.
-Added all fixes and updates.
faaliyet
Added to Seo Urls:
pollbooth.php
newsdesk_index.php
newsdesk_info.php
newsdesk_reviews_info.php
newsdesk_reviews_article.php
file changed:
includes/classes/seo.class.php
.htaccess
No all packpage
only file changed
Related to the below update regarding URL redirection, you could also make the change in /includes/functions/html_output.php to not output the OSC session id on the first page. I've tested this and there are no issues when this is done. The url that was beign redirected to with this "bug" was similar to:
-c-16?osCsid.html
Note that it put the ?osCsid before the .html.
Change:
function tep_href_link($page = '', $parameters = '', $connection = 'NONSSL', $add_session_id = true, $search_engine_safe = true) {
to:
function tep_href_link($page = '', $parameters = '', $connection = 'NONSSL', $add_session_id = false, $search_engine_safe = true) {
See that I changed $add_session_id to false. That's it.
while I was listing products on ultimate seo contribution, I realize that the link for the following pages doesn't work.
Instead of searching for the bug I search on internet and find the solution quickly.
Example links:
.html?page=2&sort=2a ----> replace to that, in link it was up to html. ?page=2&sort=2a and similar things on the link were not working.
index.php?manufacturers_id=14&sort=2a&page=2
For those who have the same problem as me: ;
In seo.class.php, (at lines 1060 and 1061)
Find This Lines:
header("HTTP/1.0 301 Moved Permanently"); //let the SE's know to not use this link
header("Location: $link"); //redirect to the real page
And Replace With:
// header("HTTP/1.0 301 Moved Permanently"); //let the SE's know to not use this link
// header("Location: $link"); //redirect to the real page
That's All (No file).
Ultimate SEO URLs Version 2.1e
This is the entire package, with Update Instructions included.
What's changed in this version?
Fixed: Ugly URLs in the Shopping Cart
Description of the Problem:
Products with Attributes appear in your cart as "product_info.php?products_id=5{1}10{2}20{3}30".INSTEAD of the SEO url!
This problem might appear elsewhere, too (eg. Reviews, Add to Cart).
The attributes are the numbers that appear after the first {curly brace}.
This fix will turn urls with attributes into: "product-name-p-5.html?options={1}10{2}20{3}30" so that users do not see the ugly urls in their shopping carts.
Current Version: 2.1e
Derived from: "2.1d ORIGINAL updated"
Updated to support newer version of Informationpages unlimited.
Minor changes to SQL names in seo.class.php
I attach this file not to add to the carnage but in the hope that it'll get people back to using Chemos ORIGINAL great script. To my knowledge this was the last version wholely worked on by Chemo.
Update: Mildy doctored seo.class.php otherwise standard.
Works with MySQL5 (Strict mode)
Works with PHP5
Added tep_output_string($_sid)
Included is the validation contribution which is optional not essential.
It's a shame, but this great contribution is being ruined imo.
I attach this file not to add to the carnage but in the hope that it'll get people back to using Chemos ORIGINAL great script. To my knowledge this was the last version wholely worked on by Chemo.
Update: Mildy doctored seo.class.php otherwise standard.
Works with MySQL5 (Strict mode)
Works with PHP5
Added tep_output_string($_sid)
Included is the validation contribution which is optional not essential.
Reloaded version with fix for the last versions of Information Pages applied.
Users of information pages unlimited using the newer version or using older version, please see:
http://www.yoja.nl/kb/index.php/Oscommerce_ultimate_seo_urls_-i-1.html_and_-c-1.html_fixes
This package includes Ultimate SEO URLs 2.2.2e, .htaccess patch by dp.ramone, and 3chaitanya bugfix. This a full package with corrected install instructions.
Bugfix from umarov_t is not included because it isn't for this version.
PLEASE UPLOAD ONLY FULL PACKAGES!
Have you seen easypopulate contribution page? Have you found the right working version? No? So Upload ONLY Full Packages!
redirects to same Product info page.
In /catalog/includes/classes/seo.class.php
Under function ValidateName
Find:
if ((strpos($parts[count($parts) - 2], $type)) !== FALSE)
Replace with:
if ($parts[count($parts) - 2] == $type)
This package includes Ultimate SEO URLs 2.2.2e, .htaccess patch by dp.ramone, and pre-edited files. There are no other patches included in this package. I put this together to help out the novice and save some time.
This saves you from having to make all the changes yourself. If you have made changes to any of the following files, this package is not for you:
includes/application_top.php
includes/functions/html_output.php
admin/categories.php
admin/includes/functions/general.php
.htaccess
Just upload the /catalog/ directory to your store and enjoy. The /catalog/ directory in this package has the required SEO files already in place.
If your store is not located in /catalog/, please be sure to update the .htaccess file in the /catalog/ directory with the path to your store.
The link manager code in seo.class.php is ok, but to work correctly requires an additional rewrite rule in .htaccess that is missing from the documentation.
Not a full package.
This patch add the parent category name before the product name in URL, to get url path as http://mystore.com/games-strategy-disciples-sacred-lands-p-24.html
This is not for everybody. But if you're getting URL's for your categories like this:
http;//www.yoursite.com/-c-2.html
instead of:
http://www.yoursite.com/categoryname_keyword-c-2.html
Then your version of mysql needs a new seo.class.php.
Just upload it to your (catalog)/includes/classes/ folder and your categories names will again appear!
This file contains only the seo.class.php file, and nothing else, so this is not the complete contribution -- this fix only for those who had the problem mentioned above.
Find
$sql = "SELECT cd.categories_seo_url, c.categories_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";
Change it to:
$sql = "SELECT cd.categories_seo_url, c.categories_id, c.parent_id, cd.categories_name AS cName, cd2.categories_name AS pName
FROM ".TABLE_CATEGORIES." c
INNER JOIN ".TABLE_CATEGORIES_DESCRIPTION." cd ON cd.categories_id = '".(int)$single_cID."'
AND cd.language_id='".(int)$this->languages_id."'
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."'
LIMIT 1";
Admin
http://www.oscommerce-packages.com
Scope: Bug in Ultimate SEO 2-2.2e.
I am not sure if it exists or added in this version.
Bug description: When one clicks to check review page by clicking review link on product_info page, it
redirects to same Product info page.
In /catalog/includes/classes/seo.class.php
Under function ValidateName
Find:
if ((strpos($parts[count($parts) - 2], $type)) !== FALSE)
Replace with:
if ($parts[count($parts) - 2] == $type)
This is the last full version, that I know of by Chemo. It contains the following changes:
- added code to handle Links Manager links (not my code)
- added code to fix problem with invalid names in the url's.
This is a full package but is based on the version mentioned above. It does not contain all of the changes everyone is making. The only file that was changed is the classes/seo_class.php so you can compare that to your file if you want to have these options. See the support thread for more details:
http://forums.oscommerce.com/index.php?showtopic=130999&st=1440
This is full package of Ultimate SEO URLs - 2.1d (29 Aug 2007) with all fixes, by Cpedit , with support of russian (cyrillic) names of products, categories etc. All cyrilic characters converting to latin. Shoud work with any cyrillic language, just check substitution arrays in /catalog/includes/classes/seo.class.php (search for string "$trdic = array" in the code, there are 7 entrys of this string).
1] Problem found when a product has been added to the shopping cart, the cart remains empty.
line 653 :
MODIFY >> return htmlspecialchars (utf8_encode ($link));
IN >> return htmlentities (utf8_encode ($link), ENT_QUOTES);
2] Modify INSTALL instructions
Bug SQL line 976 :
MODIFY >> JOIN ".TABLE_CATEGORIES_DESCRIPTION." cd
ON >> LEFT JOIN ".TABLE_CATEGORIES_DESCRIPTION." cd
Original Package : Ultimate SEO URLs - 2.1d (25/11/2006) with all fix.
Can somebody please make a full package of this great contribution
The option "Add category parent to begining of URLs?" resulted in adding always the parents name and not the value of the seo field of the parent category if available.
this is fixed in the attached seo.class.php. The class is based on Ultimate SEO URLs Contribution - osCommerce MS-2.2 and simply has to be put in the includes/classes directory. Find a description of the changes included to the zip archive.
All the best
benjamin
My last post was a bit premature.
Here is the actual dutch language files for Ultimate SEO URLs.
This modest contribution enables you to view the SEO Admin panel in Dutch.
This version is a modification on the one uploaded by Glcustoms on 8 Jul 2007.
It fixes the missing table fields products_seo_url and categories_seo_url.
At installation time, their existence is checked. They are added, just in case they are not found.
For those that use page manager 1.7 & up :
http://www.oscommerce.com/community/contributions,2021/category,all/search,pages_html_t
ext
Here is the code to make your urls work with that. Just overwrite seo.class php
and in htaccess find:
RewriteRule ^(.*)-i-([0-9]+).html$ information.php?info_id=$2&%{QUERY_STRING}
change to:
RewriteRule ^(.*)-pm-([0-9]+).html$ info_pages.php?pages_id=$2&%{QUERY_STRING}
TO DO:
Make links in infobox show as html, as of now only the url is showing as HTML.
I've overlooked one SQL statement for the cache further down in the SEO class.
Here'e a link to the complete fix (thanks to CraXyOW3 for posting it to the forum's SEO URL thread):
http://www.yoja.nl/kb/index.php/Oscommerce_ultimate_seo_urls_-i-1.html_and_-c-1.html_fixes
Or download the attached seo.class.php file if you prefer.
More recent versions of IPU (info pages unlimited) have changed the field names of the information table resulting in SEO URLs such as http://www.your-store.com/-i-8.html
In order to fix this you have to make two minor changes to the sql query in seo.class.php betweenlines 1144 to 1148 like so:
$sql = "SELECT information_title as iName
FROM ".TABLE_INFORMATION."
WHERE information_id='".(int)$iID."'
AND language_id='".(int)$this->languages_id."'
LIMIT 1";
I've uploaded only the seo.class.php file for those who don't want to manually change the sql statement.
Sorry to embarass those who were expecting a full package.
With so many updates and bug fixes, any chance of someone releaseing a full working updated fixed version in a full package?
Best SEO contribution our.
when using Ultimate SEO URLs contribution , account creation page gives error, this small code change FIXes this big poblem
in includes/functions/database.php
find tep_db_insert_id function near 110
and replace function to:
function tep_db_insert_id( $link = 'db_link') {
global $$link;
return mysql_insert_id($$link);
}
thats all.. you can create account if you live this problem wth seo url
If you install Ultimate SEO URLs for the first time, run the following MySQL-query in your osC database:
ALTER TABLE `categories_description` ADD `categories_seo_url` VARCHAR( 100 ) NOT NULL ;
ALTER TABLE `products_description` ADD `products_seo_url` VARCHAR( 100 ) NOT NULL ;
( otherwise in the admin-catalog area you may get error: 1054 - Unknown column 'cd.categories_seo_url' in 'field list' )
There should be an exit after 301 redirect.
header("HTTP/1.0 301 Moved Permanently");
header("Location: $url"); // redirect...bye bye
exit;
break;
TIPS
-----
seo.class.php start with "<?"
change it by "<?php"
Maybe it can help you
look at your logs from apache and php, they can help you
Be careful with ".htaccess" file, specially with "RewriteBase" line. Because it can be :
- RewriteBase /
- RewriteBase /catalog/
- RewriteBase /MyStore/
- etc
for cookies look at :
http://forums.oscommerce.com/index.php?showtopic=137940&st=0&gopid=940437&#entry940437
Use the forum
Good luck
Here is part of the lighttpd config used to rewrite SEO URLs to internal addresses. Adapted from .htaccess mod_rewrite rules included in 2.1d package.
Now that we have a new release of Ultimate SEO with customs url's, the prior fix for the seo.class.php file for mysql5 is now out of date. I have updated this.
This is not a full contribution.
if you're getting an error "memory exhausted", while script memory consumption is much lower
than memory limit and you have many products in your store (more than 10000 estimated). It happens rarely and not on all servers. Don't know on what server setting it relies, but here is the fix, helped in my case. This package contains fix only.
Fix applied to application_top.php file code.
Thanks to Nelus.
Full Package Here.
Now includes the ability to create your own Product and Category URLs.
a) Product examples:
www.domain.com/product-name-p-32.html
www.domain.com/product-name-extra-text-p-32.html
www.domain.com/my-text-p-32.html
b) Category examples:
www.domain.com/category-name-c-44.html
www.domain.com/category-name-extra-text-c-44.html
www.domain.com/my-text-c-44.html
If you do not set your own url then the url reverts back to being dynamically created.
------
As per 2.1d release - this is released under GNU General Public License.
The documentation (not the code) on the previous uploads (2.1d and anything built on that code base) was covered under Open Public License.
Bobby Easland (Chemo) has agreed to allow the full contribution to be released under GNU General Public License - code and documentation. This is applicable to 2.1d as versions previous to this were already released that way.
The Open Public License has been removed from this upload.
Thanks goes to Bobby Easland.
This is not for everybody. But if you're getting URL's for your categories like this:
http;//www.yoursite.com/-c-2.html
instead of:
http://www.yoursite.com/categoryname_keyword-c-2.html
Then your version of mysql needs a new seo.class.php. And guess what? Here it is!
Just upload it to your (catalog)/includes/classes/ folder and your categories/keywords will once again appear!
This file contains only the seo.class.php file, and nothing else, so this is not the complete contribution -- it's merely a fix for those who had the problem mentioned above.
SEO doesn't work on sub-articles when using the rewrite method in 2.1
# Added to fix article glitch on sub-articles (lonniew at gmail dot com)
RewriteRule ^(.*)-t-([0-9]+_[0-9]+).html$ articles.php?tPath=$2&%{QUERY_STRING}
Building redirection links was leading into problems when using additional parameters.
[CHANGED]
removed the usage of 'htmlspecialchars' from the function href_link() and stock_href_link() . This was causing the issue and I do not see any need for this function here, and if it must be included it should be implemented as a switchable option in order to be aligned with the standard of the other functions within the same Class.
Cheers,
Tony Tromp
I had a problem with SEO enabled whereby, having viewed a manufacturers products using the manufacturers drop down in the manufacturers infobox and then choosing the 'Please select' in the dropdown, a page not found error would occur. The fix appears below:
Cheers - moosey_jude
In file catalog/includes/classes/seo.class.php
Find (about line 820-830 depending on other fixes applied):
case 'manufacturers_id':
switch(true){
case ($page == FILENAME_DEFAULT && !$this->is_cPath_string($params) && !$this->is_product_string($params) ):
and change to:
case 'manufacturers_id':
switch(true){
case ($page == FILENAME_DEFAULT && !$this->is_cPath_string($params) && !$this->is_product_string($params) && strlen($this->get_manufacturer_name($p2[1]))>0 ) :
When redirecting to the rewritten url, it may contain & strings, which are only valid for the html page, not for a redirect.
For example, http://www.mysite.com/catalog/some-item-c-49_23.html?sort=4&page=2
should be
http://www.mysite.com/catalog/some-item-c-49_23.html?sort=4&page=2
the '&' character is valid when it is displayed on a page because the browser intreprets it correctly. However when it is used in a redirect, the browser doesn't intrepret the '&' into just '&', so it shows up incorrectly in the url
Added these two lines to includes/classes/seo.class.php line #1890
# BC Redirects shouldn't have '&'s in them
$url = preg_replace('/&/','&',$url);
This is an awesome contribution! But, when it's turned off in the admin console the website stops working. This update fixes the problem. I just wrapped the original code & chemo's code in an 'if' statement. Two files must be updated:
includes/application_top.php
includes/functions/html_output.php
This is for v2.1c
-Randelia
This maintenance release fixes 1 bug (for STS stores) and adds compatibility with 2 external contributions.
BUG FIX
==============================
1) Some stores with STS installled were reporting an error like the following:
Fatal error: Call to a member function on a non-object in /path/to/html_output.php on line xx
This release uses better and more redundant logic for initializing the class.
CONTRIBUTION COMPATABILITY
==============================
1) Page Cache is now fully compatible natively. No special or alternate code to install. Follow normal upgade directions.
2) STS is now fully compatible natively. No special or alternate code to install. Follow normal upgrade directions.
KNOWN ISSUES
==============
1) Redirect code needs better logic for PHP CGI mode servers. SAPI module is fully supported.
DOCUMENTATION
==============
Upgrade directions are in the documentation
NOTE TO THE DEVELOPERS
==============
The code is THOROUGHLY documented...don't be shy...get in there and start tweaking the code! :-)
Enjoy!
Bobby
This maintenance release corrects several small bugs and adds 2 new options.
OPTIONS
==============
1) Ability to choose the option of appending the cPath parameter to the end of product info URLs (some-product-p-1-html?cPath=xx).
2) Ability to choose if parent category is included in category URLs (parent-cateogory-current-ctegory-c-1.html).
Both of these settings are able to be toggled through the admin control panel.
BUG FIXES
==============
1) Corrected code for attribute check (regex)
2) Corrected install directions
KNOWN ISSUES
==============
1) Class is not compatible with page_cache contribution. Plans are to offer support in the next release.
DOCUMENTATION
==============
Upgrade directions are in the documentation
NOTE TO THE DEVELOPERS
==============
The code is THOROUGHLY documented...don't be shy...get in there and start tweaking the code! :-)
Enjoy!
Bobby
This release introduces a completely recoded contribution designed from the ground up to be high performance in all respects.
The code has been abstracted so as to be used on the admin side for feeds. In addition, it has been optimized for speed and the absolute lowest server load possible.
The automatic 301 header redirect script has been integrated and is now native to the base class. To use the new functionality it is as easy as an admin control panel switch.
The performance cache engine has been retooled and offers many features such as the ability to choose to use the cache for one, all, or any combination of functional areas (products, categories, etc).
There is now better support for international or multi-lingual stores with the introduction of several new options.
Lastly, more areas are supported with SEO URLs. This release offers the ability to generate SEO URLs for the following:
1) Product Pages
2) Category Pages
3) Article Topics
4) Article Info
5) Information Pages
6) Product Reviews
7) Product Review Info
8) Popup Images
==============
# DOCUMENTATION #
==============
This release also marks my intent on increasing the overall quality of the documentation for my contrbutions. Be sure to give me some feedback on the format and level of completeness.
Enjoy the 2.1 release...the v3.X series is already under development :-)
Bobby
This is the beta-3 release of the automatic redirect script. This corrects a bug and forming redirect URLs from the shopping cart.
INSTALLATION
============
Read the file...it is contained within the script. Very easy installation. Upload the file and add one line of code to application_top.php
NOTES
======
Please test this thoroughly and report any bugs in the support thread.
This is the beta-2 release of the automatic redirect script. The code has been completely reworked from the ground up.
INSTALLATION
============
Read the file...it is contained within the script. Very easy installation. Upload the file and add one line of code to application_top.php
NOTES
======
Please test this thoroughly and report any bugs in the support thread.
Bobby
This is a one file patch to address the issue of URLs that are indexed with search engines and should be redirected.
HOW THIS PATCH WORKS
====================
This patch automatically detects which old URL was used (regular stock osC, SEF URLs, or even cName) and sends a 301 moved permanently redirect to the proper page.
NOTES
====================
This is beta code. I have tested this patch thoroughly but there is no way for me to catch every possible scenario. If you experience difficulties or errors please post in the support thread.
Bobby
This is a full release package with additional directions for those store owners that:
1) Are upgrading from version 1.4
or
2) Have a CRE Loaded store
====================================
RELEASE NOTES:
If you have less than version 1.4 installed you are encouraged to upgrade FRIST to 1.4 then to version 2.0
This release is bundled with the new osC Advanced Cache Class. This moves the cache off the filesystem and into the database.
Why store cache in the database? Well, there were some store owners that had trouble with setting up a cache directory and also getting the permissions correct. This is an elegant solution to those problems since there is no need to enter any path or setup any directory with the right permissions. Also, the cache class will serve as the backbone of my future releases (osC Advanced Templating Engine, osC Search Engine / Spider, more performance enhancements, etc).
===========
= BUG FIXES =
===========
1) Fixed logic problem on admin side with resetting cache. Change is located in admin/categories.php
========
= NOTES =
========
This is a full package release and is bundled (files and directions) with the osC Advanced Cache Class. As such, I wanted to move the support to a new thread to keep the versions separate. If you have a support request please post it in the Ultimate SEO URLs v2.0 thread.
Enjoy!
Bobby
This release corrects a bug in the filter short words option.
SYMPTOM: if the category / product name is completely filtered out (i.e. - all words are less than the short words limit) then it would give an error about bad arguments in the implode function.
FIX: check to see if the entire string was filtered and if so pass the original string
This release adds the option of filtering short words from the URLs. Admin control panel setting allows filter word length to be configured conveniently.
Also, fixed a small issue of admin delete cache file compatibility on certain FreeBSD servers.
This release corrects 2 bugs:
1) "buy now" button did not return to the correct category and gave a product not found message
2) "buy now" column would have the same products_id for every product on the page with cName option
Also, update install directions page and gave WebPixie and Fred Doherty credit for additions.
Ok, I think I have this documented ok.
It adds manufacturers to the mod, so they will be
http://yourdomain.com/sony-products-m-49.html
just like products and categories. I did this for my site and it's working fine, hopefully I didn't miss anything when I pulled it out of my script. I DID NOT add the manufacturers code into the page cache user's code as I do not use it and didn't want to break anything. Please BACKUP your files, if I missed anything I can't be responsible.
Basic changes are in .htaccess, html_output.php code, application_top.php code, and seo-cache.php. Also, make sure you clear your seo-cache after adding it so it will add the manufacturers too.
Fixed a missing instruction for the upgrade from Cname and created an instruction guide just for upgraders. Everything else is as the previous contibution file.
I am proud to announce the release of Ultimate SEO URLs for osCommerce-MS2.
This contribution builds on the cName & pName code to give an even more flexible, search engine friendly, and cross server compatible SEO URLs.
Once installed, Ultimate SEO URLs will give the store owner the choice of the v1.X style cName or new v2.X style static HTML file. This setting is incorporated into the admin control panel so can be toggled on, off, cName, or Rewrite at will.
This contribution will work for any store on any server. It is compatible with not only *NIX based servers but also Windows/IIS servers (although IIS is limited to cName).
In addition, this contribution is compatible with all other contributions by me including Page Cache (directions included in install package).
This release supports multiple languages, unlimited nested categories, and duplicates with ease.
Note: Contributions are used at own risk.