Jump to content
Latest News: (loading..)
spidometrs

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

Recommended Posts

A new version has been uploaded with these changes:

 

- Changed code so that it works with the new Header Tags SEO url field

- Corrected spelling mistake in options (permormance) as found by user 14steve14)

- Corrected mistake for get_topic_name function for Article Manager

- Corrected a typeo for the category=0 code that caused a failure for some shops

- Removed type definition from table for MYSQL compatibility

Share this post


Link to post
Share on other sites

The code doesn't remove it. That is the basic operation of oscommerce, as I recall.

Why does oscommerce not remove it when I change it here?

$anchor = preg_replace($pattern, '-', $anchor); ---> $anchor = preg_replace($pattern, '/', $anchor);

 

Actually slash in the product name is not an issue (it is better if it is replaced by hyphen, of course). I am trying to replace only one hyphen by slash: between parent category and subcategory, and between the parent category and the product name. Is that possible?

Edited by Beginner_OS

Share this post


Link to post
Share on other sites

Oh, that's different. It is probably possible. In fact, I think someone posted code here at some point on how to do it. I've no idea where in this thread that would be though.

Share this post


Link to post
Share on other sites

I found that code, but it does not work, as it modified a very old version and a lot of things have been changed since then.

I am not sure whether it is really needed, but according to google recommendations, URL should follow the rule shop/parentcategory/subcategory/product.html.

Your script is excellent, but all products are kind of in the same folder for google ...

 

Basically, only one replacement:

 

parentcategory- to parentcategory/

 

would do the job and I tried this, but slash is erased by something. Even the straightforward change of the parentcategory name to the one ending with '/' does not help as slashes are removed afterwards. Some (useless, in the product name) are not and this is puzzlng.

Edited by Beginner_OS

Share this post


Link to post
Share on other sites

The accepted SEO practice is to use hyphens over slashes. When you have something like .../category1/category2/my_product, the categories are treated as levels by the search engines. In years past, it was considered harmful if there were more than three levels. But if you have .../category1-category2-my_product, it is considered one level and the keywords used in category1 and category2 apply directly to the product page. Also, in the SEO 5 addon, which is another url rewriter, one of the url options is to create a url like .../product/product_name, where the first word is actually product. The result is that the sites using that format rank for the keyword product, which is a total waste. So I don't recommend making this change. If you are determined to do it though, it can be done so good luck.

Share this post


Link to post
Share on other sites

hi together! i just installed the contrib and if i check the shop, www.sauces.ch, (2.3.3.4 Shop) it Looks fine. But,if i want to open the admin, i get the following error. how can i solve this? thanks for any help!

 

Fatal error: Cannot redeclare tep_reset_cache_data_seo_urls() (previously declared in /home/httpd/vhosts/sauces.ch/httpdocs/admin/includes/functions/general.php:1477) in /home/httpd/vhosts/sauces.ch/httpdocs/admin/includes/functions/general.php on line 1659

 

cheers

patrik

Share this post


Link to post
Share on other sites

The accepted SEO practice is to use hyphens over slashes. When you have something like .../category1/category2/my_product, the categories are treated as levels by the search engines. In years past, it was considered harmful if there were more than three levels. But if you have .../category1-category2-my_product, it is considered one level and the keywords used in category1 and category2 apply directly to the product page. Also, in the SEO 5 addon, which is another url rewriter, one of the url options is to create a url like .../product/product_name, where the first word is actually product. The result is that the sites using that format rank for the keyword product, which is a total waste. So I don't recommend making this change. If you are determined to do it though, it can be done so good luck.

 

Thanks a lot! This sounds convincing. I thought it will be helpful for the sitemap. Isn't it better if everything is well structured and URLs correspond to that structure.

 

Another question. What about the multilanguage issue? Is it still currently preferrable to have shop/en/category... ?

Share this post


Link to post
Share on other sites

@@Beginner_OS You should be using this sitemap addon. The urls will be formatted correctly. For the languages, no, it is not necessary to do that as long as your shop has code for the canonical meta tag. This is present if you have Header Tags SEO installed, a later version of 2.3 or the addon for that purpose.

Share this post


Link to post
Share on other sites

Thank you! I installed both addons you mentioned.

I thought canonical meta tags are needed when one of the pages with similar content should be emphasized. In this case the information is different since it is given in different languages. Or search engines do not consider this as a big difference?

Share this post


Link to post
Share on other sites

That tag is necessary when there might be a situation of duplicate content to prevent that from happening, not to emphasize one over the other.

Share this post


Link to post
Share on other sites

Removed duplicate post.

Edited by Jack_mcs

Share this post


Link to post
Share on other sites

Hello Jack!

 

Above all, all praise for your work! :)

....

 

I still have a problem with converting, any idea why?

 

( Clean OS 2.3.34 - 3 languages,- Header Tags SEO v3.3,1 and Ultimate SEO URLs v2.2_13)

 

(conv ć=>c,č=>c,š=>s,đ=>dj,ž=>z,ü=>ue,ö=>oe,ä=>a,ß=>s)

 

Thanks in advance!

 

Bojan Luka

Edited by Lukalu

Share this post


Link to post
Share on other sites

Thank you. :) I tested it here and it is working correctly. You may want to try clearing the cache using this addons option. Also, look in the tools section for changing database tables and run it on the cache table.

Share this post


Link to post
Share on other sites

You need to post your .htaccess file and the url for your site.

Share this post


Link to post
Share on other sites

Hi!

First of all: nice plugin! Have been using it for a couple of years now!

A client noticed that if a product is in multiple categories, the link created does not always show the right category.

 

For example:

A product is in the category 'girls' and the category 'boys'. When you look at the 'girls' category page (in the catalog), the right URL's show up. If you look at the 'boys' category page, for some products the URL to the 'girls' page shows up (those are the products being in 2 categories). I can imagine how this error occurs, probably has something to do with the 'girls' category being the first in the database result or something. My question though is if there is some fix available to prevent this from happening. It causes some confusion at customers, so it would be nice to have it fixed.

Any ideas on this?

Thanks!

 

Eric

Share this post


Link to post
Share on other sites

If you are saying you have two products and the links are not working correctly, then there is something wrong with your shops code. If you are saying you have one product that is linked to two categories, then that is a common problem with how oscommerce is coded. The path to the product will depend upon how it was reached. There is a fix for that. I've not tried it but others say it works. See here.

Share this post


Link to post
Share on other sites

How can I deal with special latin chars like ó é á

 

I tryed to use "Enter special character conversions" like "ó=>o" but it causes a redirect error when I try to load the page.

Edited by lov

Share this post


Link to post
Share on other sites

It may be one of the other settings. Try turning them all off and see what happens. Also be sure you are entering the characters in the format as shown for that option.

Share this post


Link to post
Share on other sites

It may be one of the other settings.

 

What other settings are you talking about?

 

Try turning them all off and see what happens.

What do you mean by turning them all off? How to do it? I tryed one url containing a ó, after setting "ó=>o", and it simply not worked, just showed a redirect error. I also tryed "é=>e", the same.

 

Also be sure you are entering the characters in the format as shown for that option.

yes, I tryed all these:

ó=>o

é=>e

ó=>o,é=>e

Share this post


Link to post
Share on other sites

Go to the place where you enter in the character translation and look above it for other settings.

Share this post


Link to post
Share on other sites

2.3.3.4 Shop on PHP 5.4.21

 

Works perfectly on my test store using Uniserver

 

Store is now live on host and works correctly with SEO turned off until I include the code into htaccess when it throws a 500 error on both store and admin.

 

Originally I had a whole list of additions in htaccess inherited from my RC2.2a store and I thought one of them is the culprit but no. I removed them all and just tried the seo code with RewriteBase set thus RewriteBase / but still the same

 

store is www.mhvideos.co.uk

 

# $Id$
#
# 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)

# php_value session.use_trans_sid 0
# php_value register_globals 1

# Begin Ultimate SEO V2.2d
Options +FollowSymLinks
RewriteEngine On

# RewriteBase instructions
# Change RewriteBase dependent on how your shop is accessed as below.
# http://www.mysite.com = RewriteBase /
# http://www.mysite.com/catalog/ = RewriteBase /catalog/
# http://www.mysite.com/catalog/shop/ = RewriteBase /catalog/shop/

# Change the following line using the instructions above

RewriteBase /

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 ^(.*)-by-(.*).html$ all-products.php?fl=$2&%{QUERY_STRING}
RewriteRule ^(.*)-t-(.*).html$ articles.php?tPath=$2&%{QUERY_STRING}
RewriteRule ^(.*)-a-(.*).html$ article_info.php?articles_id=$2&%{QUERY_STRING}
RewriteRule ^(.*)-au-(.*).html$ articles.php?authors_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 ^(.*)-f-(.*).html$ faqdesk_info.php?faqdesk_id=$2&%{QUERY_STRING}
RewriteRule ^(.*)-fc-(.*).html$ faqdesk_index.php?faqPath=$2&%{QUERY_STRING}
RewriteRule ^(.*)-fri-(.*).html$ faqdesk_reviews_info.php?faqdesk_id=$2&%{QUERY_STRING}
RewriteRule ^(.*)-fra-(.*).html$ faqdesk_reviews_article.php?faqdesk_id=$2&%{QUERY_STRING}
RewriteRule ^(.*)-i-(.*).html$ information.php?info_id=$2&%{QUERY_STRING}
RewriteRule ^(.*)-links-(.*).html$ links.php?lPath=$2&%{QUERY_STRING}
RewriteRule ^(.*)-pm-([0-9]+).html$ info_pages.php?pages_id=$2&%{QUERY_STRING}
RewriteRule ^(.*)-n-(.*).html$ newsdesk_info.php?newsdesk_id=$2&%{QUERY_STRING}
RewriteRule ^(.*)-nc-(.*).html$ newsdesk_index.php?newsPath=$2&%{QUERY_STRING}
RewriteRule ^(.*)-nri-(.*).html$ newsdesk_reviews_info.php?newsdesk_id=$2&%{QUERY_STRING}
RewriteRule ^(.*)-nra-(.*).html$ newsdesk_reviews_article.php?newsdesk_id=$2&%{QUERY_STRING}
RewriteRule ^(.*)-po-([0-9]+).html$ pollbooth.php?pollid=$2&%{QUERY_STRING}
# End Ultimate SEO V2.2d

 

The original htaccess with all the additions is in force at this time.

Any help would be greatly appreciated

 

Martin


OsC 2.3.4.1 CE Frozen   PHP 7.2   MySQL 10.1.36-MariaDB-cll-lve

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

×