Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

[Contribution] Ultimate SEO URLs - by Chemo


Guest

Recommended Posts

From one Paul to another. ;) HOWDY.

 

I am making an assumption here. But, it looks like your store is in the root directory. Is that correct or are you using another redirect somewhere?

 

Maybe if you post your .htaccess file, that would help.

 

Paul

 

Hi Paul

 

Not using any redirects.

.htaccess file reads as follows

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

 

Paul

Regards

Paul

Link to comment
Share on other sites

  • Replies 1.9k
  • Created
  • Last Reply

Top Posters In This Topic

Hi Paul

 

Not using any redirects.

.htaccess file reads as follows

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

 

Paul

 

Ah, if your store is indeed in the root directory and not in a directory called 'folder' as I suspect, then try this code.

 

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

[/code]

 

Note the line about the RewriteBase. ;)

 

Paul

Edited by Fourbit
Link to comment
Share on other sites

Ah, if your store is indeed in the root directory and not in a directory called 'folder' as I suspect, then try this code.

 

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

[/code]

 

Note the line about the RewriteBase. ;)

 

Paul

 

Hi Paul :D

 

Thanks. In future i will follow my nose before posting. I looked at the code and wondered it that was the problem. Working fine now. Thanks for your help.

 

Next contrib will be sitemap, so no doubt i'll be back on here soon :'(

 

Paul

Regards

Paul

Link to comment
Share on other sites

Chemo, why did you choose

 

yourdomain.com/dvd/speed_one.html

 

would it not have been better to use?

 

yourdomain.com/dvd/speed-one/

First, it is interpreted as being one level deeper in the domain which has been speculated as having less keyword proximity. This point is arguable and I won't start the discussion. My reply is to read up at http://seochat.com which is where I based a lot of my format (such as using a - instead of _ for space separation). If you want to modify it for your own needs please feel free to do so.

Hi Bobby,

 

I believe I followed step by step instructions (very nicely done in html by the way!)  I also altered the .htaccess (root where my shop is) uiploaded as instructed but I get the following errors when the shop displays. (admin seems OK) I went back and restored both my includes/application_top.php & includes/functions/html_output.php and it's back to norm but I would like your contrib. What did I do wrong?

Thanks, KJ

The parse error is killing everything...welcome to PHP programming :)

 

Find the error and correct it and everything will work fine.

 

Bobby

Link to comment
Share on other sites

Hi,

I looked at that line, it was the end of the copy w/ a duplicate }. I have no error on page now but I can't seem to get the pages to read in this SEO method??

 

My .htaccess (root installation)

RewriteEngine On

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}

ErrorDocument 400 /http_error.php?error_id=400

ErrorDocument 401 /http_error.php?error_id=401

ErrorDocument 403 /http_error.php?error_id=403

ErrorDocument 404 /http_error.php?error_id=404

ErrorDocument 405 /http_error.php?error_id=405

ErrorDocument 408 /http_error.php?error_id=408

ErrorDocument 415 /http_error.php?error_id=415

ErrorDocument 500 /http_error.php?error_id=500

ErrorDocument 501 /http_error.php?error_id=501

ErrorDocument 502 /http_error.php?error_id=502

ErrorDocument 503 /http_error.php?error_id=503

ErrorDocument 505 /http_error.php?error_id=505

ErrorDocument 504 /http_error.php?error_id=504

Options +Includes +ExecCGI +FollowSymLinks

 

I'm wondering about the path for the cache?

I have currently: /cache/seo_cache/

Should it be the relative site path i.e.? var/www/html/cache/seo_cache/

 

Thanks for any help.

KJ

define('PROJECTS', 'Something that goes on forever!');

Link to comment
Share on other sites

Rear one chemo,

 

excuses please my bad (Google) English!!!!

 

Your Contrip is really ingeniously - large radix complement!!!

 

I (or we from the German linguistic area) would have however still another request!!

 

Is it possible to change also the letters??

 

? = ae

? = oe

? = ue

? = ss

 

then really last all perfect.

 

Thanks - Boergi

 

Like:

http://www.mydomain.de/catalog/dachtr%E4ger-bmw-c-22_54.html

to

http://www.mydomain.de/catalog/dachtraeger-bmw-c-22_54.html

Link to comment
Share on other sites

Website here

 

Your insight is appreciated very much.

 

Thank you, KJ

 

Hi Bobby,

 

Call off the dogs...

I found the problem. You have to have your server running in high security mode. The php works fine then (as I can see?) but check it out anyway if you wish (I'm not sure that the manufacturers are getting optimized however). I'm going to add the SEO Sitemap as suggested next but was wondering on the .htaccess

 

How should this be merged with your .htaccess lines?

 

# Change filename to .htaccess
# Remove these comments 
# Upload in ASCII mode
# chmod .htaccess 644
# Make sure in httpd.conf AllowOverride All is in <Directory> for your website
# Good Luck.
RewriteEngine on
Options +FollowSymlinks
DirectoryIndex home.html home.php index.php index.html
AddType application/x-httpd-php php php4 php3 html htm
RewriteRule ^sitemap_categories.html$ sitemap_categories.php [L]
RewriteRule ^sitemap_products.html$ sitemap_products.php [L]
RewriteRule ^category_([1-9][0-9]*)_([1-9][0-9]*)_([1-9][0-9]*)_([1-9][0-9]*)_([1-9][0-9]*)_([1-9][0-9]*)\.html$ index.php?cPath=$1_$2_$3_$4_$5_$6 [L]
RewriteRule ^category_([1-9][0-9]*)_([1-9][0-9]*)_([1-9][0-9]*)_([1-9][0-9]*)_([1-9][0-9]*)\.html$ index.php?cPath=$1_$2_$3_$4_$5 [L]
RewriteRule ^category_([1-9][0-9]*)_([1-9][0-9]*)_([1-9][0-9]*)_([1-9][0-9]*)\.html$ index.php?cPath=$1_$2_$3_$4 [L]
RewriteRule ^category_([1-9][0-9]*)_([1-9][0-9]*)_([1-9][0-9]*)\.html$ index.php?cPath=$1_$2_$3 [L]
RewriteRule ^category_([1-9][0-9]*)_([1-9][0-9]*)\.html$ index.php?cPath=$1_$2 [L]
RewriteRule ^category_([1-9][0-9]*)\.html$ index.php?cPath=$1 [L]
RewriteRule ^product_([1-9][0-9]*)\.html$ ?product_info.php?&products_id=$1 [L]

Edited by Top_Speed

define('PROJECTS', 'Something that goes on forever!');

Link to comment
Share on other sites

KJ Miller,

 

I looked at the site and it appears as though everything is working...still need support?

 

Bobby

 

Thanks Bobby,

 

2 things,

 

1st) Manufacturers are in question. Q? If you que them through the mfg's drop down box and select one, I still get the old osC paths?

 

2nd) How did you merge your .htaccess with the above posted SEO Sitemap .htacess

 

 

Thanks, You have been great!

PS. I will have my secretary make a contrib for me to your paypal acct, I would like to help promote future add-on coding like this.

 

Cheers, KJ

define('PROJECTS', 'Something that goes on forever!');

Link to comment
Share on other sites

Thanks Bobby,

 

2 things,

 

1st) Manufacturers are in question. Q? If you que them through the mfg's drop down box and select one, I still get the old osC paths?

 

2nd) How did you merge your .htaccess with the above posted SEO Sitemap .htacess

Thanks, You have been great!

PS. I will have my secretary make a contrib for me to your paypal acct, I would like to help promote future add-on coding like this.

 

Cheers, KJ

1) That is a known issue IF you use the dropdown menu. If you use the dropdown it constructs the URL's through other code and does NOT use tep_href_link() which is the heart of the Ultimate SEO URLs contribution. I will post code to get those worked out. I did not get it in the current release since I wanted to get feedback on the functionality of the basics before adding other areas...it makes for easier and faster debugging that way.

 

2) The .htaccess additions only add 2 more RewriteRules and can be added t

 

 

# Change filename to .htaccess
# Remove these comments 
# Upload in ASCII mode
# chmod .htaccess 644
# Make sure in httpd.conf AllowOverride All is in <Directory> for your website
# Good Luck.
RewriteEngine on
Options +FollowSymlinks
DirectoryIndex home.html home.php index.php index.html
AddType application/x-httpd-php php php4 php3 html htm
RewriteRule ^sitemap_categories.html$ sitemap_categories.php [L]
RewriteRule ^sitemap_products.html$ sitemap_products.php [L]
RewriteRule ^category_([1-9][0-9]*)_([1-9][0-9]*)_([1-9][0-9]*)_([1-9][0-9]*)_([1-9][0-9]*)_([1-9][0-9]*)\.html$ index.php?cPath=$1_$2_$3_$4_$5_$6 [L]
RewriteRule ^category_([1-9][0-9]*)_([1-9][0-9]*)_([1-9][0-9]*)_([1-9][0-9]*)_([1-9][0-9]*)\.html$ index.php?cPath=$1_$2_$3_$4_$5 [L]
RewriteRule ^category_([1-9][0-9]*)_([1-9][0-9]*)_([1-9][0-9]*)_([1-9][0-9]*)\.html$ index.php?cPath=$1_$2_$3_$4 [L]
RewriteRule ^category_([1-9][0-9]*)_([1-9][0-9]*)_([1-9][0-9]*)\.html$ index.php?cPath=$1_$2_$3 [L]
RewriteRule ^category_([1-9][0-9]*)_([1-9][0-9]*)\.html$ index.php?cPath=$1_$2 [L]
RewriteRule ^category_([1-9][0-9]*)\.html$ index.php?cPath=$1 [L]
RewriteRule ^product_([1-9][0-9]*)\.html$  product_info.php?&products_id=$1 [L]
RewriteRule ^(.*)-p-(.*).html$ product_info.php?products_id=$2&%{QUERY_STRING}
RewriteRule ^(.*)-c-(.*).html$ index.php?cPath=$2&%{QUERY_STRING}

I added the Rewrite Engine on and RewriteBase / to have as much flexibility and compatibility as possible. However, they may not be needed if you already have a rewrite mod working or are in the root document directory.

 

Bobby

Link to comment
Share on other sites

BTW, I have uploaded Ultimate SEO URLs v1.2 which tweaks WebPixie's addition and also adds the code to fix the "buy now" issues (see jcall's posts in this thread).

 

Bobby

Link to comment
Share on other sites

Hi Bobby,

 

Did the upgrade to 1.2

Upgrade

Overwrite all files with the ones in this release, follow step #3 & #4, and run the install-seo.php script. All done!

I think you have to do step 5 as well? (includes/modules/product_listing.php)

 

It seems OK, BUT I now have 2 listings in admin/Configuation for "SEO URLs"

1st has my altered info as before, the 2nd is "new" with default info displayed.

 

Thanks, KJ

define('PROJECTS', 'Something that goes on forever!');

Link to comment
Share on other sites

KJ Miller,

 

If you have run the database install script twice and now have 2 entries for SEO URLs re-run the install script and choose the uninstall link.

 

This will remove both sets of entries.

 

Next, run the install script again to install a single setting group. Fill in the correct configuration values again. In the future, there is no need to run the install database settings script unless it has not been run previously.

 

The extra steps are for the buy now button and column. It has been reported on this thread there are 2 bugs which that code corrects.

 

I have several instant messenger accounts (AIM, MSN, and Yahoo) and can usually be found online...just contact me and I'll walk you through any other issues.

 

Bobby

Link to comment
Share on other sites

For those links that Google has crawled already, I have higher placement on search results than I used to. This contrib is definitely making a difference.

 

Thanks again, Bobby!

 

-jared

Link to comment
Share on other sites

I recently installed this module.  It was easy as pie.  Thanks for the great work Bobby!

--Andy

Glad you enjoy it!

 

BTW, I'm right down the road from you (south of Lexington in Richmond). If you need any other help just give me a shout...

For those links that Google has crawled already, I have higher placement on search results than I used to.  This contrib is definitely making a difference.

 

Thanks again, Bobby!

 

-jared

Wait until you see what the rewrite does for you :)

 

It may be best to come up with some code to send 301 headers for the old URLs so that all accumulated rank will transfer. Also, it will keep from getting tagged for duplicate content which is important for stores that have been established for a while. I'll see what I can come up with...

 

Bobby

Link to comment
Share on other sites

Parse error: parse error, unexpected T_CASE in /home/aliandad/public_html/includes/application_top.php on line 390

 

Ahh,,, I don't know what could be wrong, I have gone over the install , and also tried a clean copy, any help would be great

 

Robert

Link to comment
Share on other sites

Parse error: parse error, unexpected T_CASE in /home/aliandad/public_html/includes/application_top.php on line 390

 

Ahh,,, I don't know what could be wrong, I have gone over the install , and also tried a clean copy, any help would be great

 

Robert

 

Need some more info. :) What do those lines look like? Say from 380 - 400?

 

Paul

Link to comment
Share on other sites

Sorry, I've been trying to figure it out by commenting things out... but it just keeps going from line to line... 380 to 400 looks like this

 

                             }
       if ( (defined('SEO_URLS') && SEO_URLS == 'true') && (defined('SEO_URLS_TYPE') && SEO_URLS_TYPE == 'Rewrite') ){
        $cPath = tep_get_product_path($HTTP_GET_VARS['products_id']);
      $cPath_array = tep_parse_category_path($cPath);
      $cPath = implode('_', $cPath_array);
      tep_redirect(tep_href_link($goto, 'cPath=' . $cPath . '&' . tep_get_all_get_params($parameters)));
       } else {
                             tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters)));
       }
                            break;
case 'notify' :         if (tep_session_is_registered('customer_id')) {
                               if (isset($HTTP_GET_VARS['products_id'])) {
                                 $notify = $HTTP_GET_VARS['products_id'];
                               } elseif (isset($HTTP_GET_VARS['notify'])) {
                                 $notify = $HTTP_GET_VARS['notify'];
                               } elseif (isset($HTTP_POST_VARS['notify'])) {
                                 $notify = $HTTP_POST_VARS['notify'];
                               } else {
                                 tep_redirect(tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action', 'notify'))));
                               }
                               if (!is_array($notify)) $notify = array($notify);

 

Thanks for the help

 

Robert

Link to comment
Share on other sites

Robert,

 

Did you get my PM?

 

I can't see anything astray here. Have you redone the cut and paste?

 

Paul

 

You are probably just not getting the whole bunch of code in the paste operation.

 

Like missing an end bracket or part of the beginning.

Edited by Fourbit
Link to comment
Share on other sites

I've checked it througly... it has to be right

 

 

I agree with Robert "it has to be right". But, I usually find it ain't. :D

 

We did find a little bit of a problem with his cut and paste. So, I think that is running now.

 

Sometimes it takes 6 eyes (I wear glasses) to find these little problems. And no matter how careful I am, I can always mess something up. ;)

 

Paul

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