Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

[Contribution] Ultimate SEO URLs - by Chemo


Guest

Recommended Posts

Okay i solved my problem. The cause was the Master Products contrib. Some sql queries in the index.php and advanced_search_results.php didnt requested the prducts_master and products_master_status from aboive mentioned contrib. The product_info.php had a routine which to set all get params, which set the buy_now action. This routine asked for the master and master_status. Because the queries on the other page didnt requested this db columns, this routine failed and didnt provide the products_id to the tep_href_link, which then itself failed and returned an "old-style" link without a products id. I added the columns to the queries and everything works fine now.

 

Now onto my other "problem", how do i modify the tep_href_link, that it always (if not empty) shows the manufacturer in the link like this

/manufacturer-product-p-10.html for every product?

Thx in advance,

regards Benjamin

Link to comment
Share on other sites

  • Replies 1.9k
  • Created
  • Last Reply

Top Posters In This Topic

So i got it working, i hope i used the right approach. Here is my code:

I only altered html_output.php:

Line 96, from:

$rewrite_page_product = short_name(constant('PRODUCT_NAME_'.$p2[1])) . '-p-' . $p2[1] . '.html';

to:

// Addition to write the manufacturers name into the static link too
$manufac_query = tep_db_query("SELECT " . TABLE_MANUFACTURERS . ".manufacturers_name FROM " . TABLE_MANUFACTURERS . " INNER JOIN " . TABLE_PRODUCTS . " ON " . TABLE_MANUFACTURERS . ".manufacturers_id = " . TABLE_PRODUCTS . ".manufacturers_id WHERE " . TABLE_PRODUCTS . ".products_id = " . $p2[1]);
$manufac_name = "";              
while ($manufac = tep_db_fetch_array($manufac_query)) {
 $manufac_name = $manufac['manufacturers_name'];
}
if ($manufac_name != '') {
 $rewrite_page_product = short_name($manufac_name) . "-" . short_name(constant('PRODUCT_NAME_'.$p2[1])) . '-p-' . $p2[1] . '.html';
} else {
 $rewrite_page_product = short_name(constant('PRODUCT_NAME_'.$p2[1])) . '-p-' . $p2[1] . '.html';
}

 

I also did some changes to the short_name function, to replace some umlauts, but this is just for the german speaking people. I just added these lines directly after the function declaration:

  $str = str_replace("?", "ae", $str);
 $str = str_replace("?", "oe", $str);
 $str = str_replace("?", "ue", $str);
 $str = str_replace(" ", "-", $str);

Im just writing this because i think i read someones post asking about this.

Link to comment
Share on other sites

Only thing I can see wrong here is you are missing 1 line -

 

Options +FollowSymLinks
RewriteEngine On
# Change "folder" to your catalog directory name
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}

Add Options +FollowSymLinks

 

 

Thanks NHRA, but that was not in the install instructions? Is that in an upgrade version or something? I downloaded v1.4, but I seem to recall that I was supposed to install this version and then upgrade... do I remember right?

 

Also, what was that other line for? Thanks

Link to comment
Share on other sites

It isn't the {QUERY_STRING} but probably some other setup consideration.  I have seen servers where you need to add:

Options +FollowSymLinks

above the RewriteEngine On directive whereas others don't.  Also, the htaccess file should a blank line (line feed) at the end of the file.

 

Do you happen to have different folders for SSL / NONSSL?

You shouldn't need to manually clear the cache as it auto-expires or is replaced with current data when you make a change to a product or category.  There are only a few situations where it would need to be manually reset...and in that case you can just set that switch to true and update the setting.

 

Bobby

 

From the Apache support site:

FollowSymLinks and SymLinksIfOwnerMatch

 

Wherever in your URL-space you do not have an Options FollowSymLinks, or you do have an Options SymLinksIfOwnerMatch Apache will have to issue extra system calls to check up on symlinks. One extra call per filename component. For example, if you had:

 

DocumentRoot /www/htdocs

<Directory />

    Options SymLinksIfOwnerMatch

</Directory>

 

and a request is made for the URI /index.html. Then Apache will perform lstat(2) on /www, /www/htdocs, and /www/htdocs/index.html. The results of these lstats are never cached, so they will occur on every single request. If you really desire the symlinks security checking you can do something like this:

 

DocumentRoot /www/htdocs

<Directory />

    Options FollowSymLinks

</Directory>

<Directory /www/htdocs>

    Options -FollowSymLinks +SymLinksIfOwnerMatch

</Directory>

 

This at least avoids the extra checks for the DocumentRoot path. Note that you'll need to add similar sections if you have any Alias or RewriteRule paths outside of your document root. For highest performance, and no symlink protection, set FollowSymLinks everywhere, and never set SymLinksIfOwnerMatch.

Link to comment
Share on other sites

Thanks NHRA, but that was not in the install instructions?  Is that in an upgrade version or something?  I downloaded v1.4, but I seem to recall that I was supposed to install this version and then upgrade... do I remember right?

 

Also, what was that other line for? Thanks

If you are starting fresh with no older SEO URLs installed, you should start with v2.0, don't bother with v1.4.
Link to comment
Share on other sites

I just posted last night,

 

Any ideas why I get 500 Interal Errors?

 

 

Options +FollowSymLinks

RewriteEngine On

# Change "folder" to your catalog directory na

RewriteBase /catalog/

RewriteRule ^(.*)-p-(.*).html$

product_info.php?products_id=$2&%{QUERY_STRING

RewriteRule ^(.*)-c-(.*).html$ index.php?cPath

RewriteRule ^(.*)-m-(.*).html$

index.php?manufacturers_id=$2&%{QUERY_STRING}

Link to comment
Share on other sites

Server setup?

 

 

 

Server OS: Linux 2.4.29-grsec+w+fhs6b+gr0501+nfs+a32+++p4+sata+c4+gr2b-v6.189 Database: MySQL 4.0.24-log

Server Date: 05/11/2005 10:54:07 Datebase Date: 05/11/2005 10:54:07

 

HTTP Server: Apache/1.3.31 (Unix) DAV/1.0.3 mod_gzip/1.3.26.1a PHP/4.3.10 mod_ssl/2.8.19 OpenSSL/0.9.6c

PHP Version: 4.3.10 (Zend: 1.3.0)

 

 

Is that enough information? I can get you what ever you need.

Link to comment
Share on other sites

Server OS: Linux 2.4.29-grsec+w+fhs6b+gr0501+nfs+a32+++p4+sata+c4+gr2b-v6.189      Database: MySQL 4.0.24-log

Server Date: 05/11/2005 10:54:07      Datebase Date: 05/11/2005 10:54:07

 

HTTP Server: Apache/1.3.31 (Unix) DAV/1.0.3 mod_gzip/1.3.26.1a PHP/4.3.10 mod_ssl/2.8.19 OpenSSL/0.9.6c

PHP Version: 4.3.10 (Zend: 1.3.0)

Is that enough information? I can get you what ever you need.

 

Also my site does use SSL for certain parts, like the check out.

Link to comment
Share on other sites

Send me a copy of your Apache httpd.conf and php.ini file. Do not post it. Send it via email. The files will be rather large so don't clutter the thread.

 

Bobby

Link to comment
Share on other sites

I just posted last night,

 

Any ideas why I get 500 Interal Errors?

Options +FollowSymLinks

RewriteEngine On

# Change "folder" to your catalog directory na

RewriteBase /catalog/

RewriteRule ^(.*)-p-(.*).html$

product_info.php?products_id=$2&%{QUERY_STRING

RewriteRule ^(.*)-c-(.*).html$ index.php?cPath

RewriteRule ^(.*)-m-(.*).html$

index.php?manufacturers_id=$2&%{QUERY_STRING}

It that EXACTLY what you have in your htaccess file?? If it is, then you need to fix it. It should look like this:

Options +FollowSymLinks
RewriteEngine On
# Change "folder" to your catalog directory name
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}

Link to comment
Share on other sites

It that EXACTLY what you have in your htaccess file?? If it is, then you need to fix it. It should look like this:

Options +FollowSymLinks
RewriteEngine On
# Change "folder" to your catalog directory name
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}

 

 

This is what is in my file.

 

Options +FollowSymLinks

RewriteEngine On

# Change "folder" to your catalog directory name

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}

Link to comment
Share on other sites

Send me a copy of your Apache httpd.conf and php.ini file.? Do not post it.? Send it via email.? The files will be rather large so don't clutter the thread.

 

Bobby

 

 

I am not sure if i mentioned this to you, but i am using a host. Dreamhost. I am not sure how to go about and get that info for you.

Edited by pura vida
Link to comment
Share on other sites

I am not sure if i mentioned this to you, but i am using a host. Dreamhost. I am not sure how to go about and get that info for you.

Call your server administrator and tell him to fix it...the problem is most likely due to restrictive configuration values in the Apache httpd.conf file. There is no way around it. Your server admin will either fix it or the contribution won't work on that server.

 

Bobby

Link to comment
Share on other sites

If you are starting fresh with no older SEO URLs installed, you should start with v2.0, don't bother with v1.4.

 

 

This is what is written on the contrib page:

 

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

 

I guess I just read that to mean that I should install v1.4 and then upgrade to v2.0, but now that I read it again, I guess that was only meant for those who already had it installed with an older version. Oops :P

Link to comment
Share on other sites

Call your server administrator and tell him to fix it...the problem is most likely due to restrictive configuration values in the Apache httpd.conf file.  There is no way around it.  Your server admin will either fix it or the contribution won't work on that server.

 

Bobby

 

 

I will do so.

 

Have you ever used Mambo. That has a SEO contribution that requires us to change the .htaccess, and that seems to work.

 

Strange.

Link to comment
Share on other sites

Hi, I had v1.4 and went to upgrade

 

I uploaded all the new files and then went to call /install-seo.php page and got the following error:

 

Fatal error: Call to a member function on a non-object in /catalog/includes/seo_cache.php on line 47

 

Anybody know what happened?

 

Here is the code on line 47 for seo_cache.php

 

$cache->is_cached($cache_file . 'products', $is_cached, $is_expired);

 

Please help

Link to comment
Share on other sites

Use this sitemap => Sitemap MS2.2 and then overwrite the base class with the one provided by Chris dated 11 Mar 2005.

 

Bobby

 

 

Thank you Chemo. It worked out perfectly.

I installed the sitemap contrib you recommended and then worked my way through your ultimate seo url.

It was much easier than I thought (at least for a noob like me :D )

Great contrib Chemo :thumbsup:

 

Shams

Link to comment
Share on other sites

Thank you Chemo. It worked out perfectly.

I installed the sitemap contrib you recommended and then worked my way through your ultimate seo url.

It was much easier than I thought (at least for a noob like me :D )

Great contrib Chemo  :thumbsup:

 

Shams

Thank you! Now that you got the hard part of the way please remember that if a small issue comes up that is unseen now search the thread! Most small issues that are server quirks have been covered. I'm working on the next version (v3.X) and need the time to dedicate to development...so I'm actively staying off the thread UNLESS it's an issue that has not already been solved or one that I could provide a different answer for. Know where I'm coming from?

 

Congrats and enjoy!

 

Bobby

Link to comment
Share on other sites

Chemo,

 

Regarding the .htaccess issue and my host. I have requested the two files today and hopefully they will help. They have already said that they will not help me with the .htaccess code you have supplied. So, for now it looks like I am SOL.

 

But, I have an idea and perhaps.. just perhaps you may be able to see something that I can not.

 

I used a solution for Mambo Content System that performed almost the same thing. They have a SEF URL module as well that requires the change in URLs. They had me change the .htaccess,

 

RewriteCond %{REQUEST_FILENAME} !-f

RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule ^(.*) index.php

 

and this appread to work without getting those errors we talked about. Is this information of any use? Can this help?

Link to comment
Share on other sites

I (re)installed the contri twice and I still get the 404 errors by selecting Rewrite in my admin while Cname works fine. But I noticed that using Rewrite I get this url:

 

zingendpratend-fotoframe-p-146.html?osCsid=8fb7d772f32cbb1a99b12c369ee3b4cc

 

Why is the osCsid still there? It should be like this:

zingendpratend-fotoframe-p-146.html

 

PLEASE can someone help me or point me to a direction ???

 

:'(

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.
Note: Your post will require moderator approval before it will be visible.

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