Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

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


Recommended Posts

With my latest fix, there is a bug when you add a product with attributes -> go to basket page -> go back to the same product page -> leave the page => error 404 comes

To avoid 404 errors, we finally need to keep the original sentence for the 3 first lines :

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-([0-9]+).html$ popup_image.php?pID=$2&%{QUERY_STRING}
RewriteRule ^(.*)-by-([0-9]+).html$ all-products.php?fl=$2&%{QUERY_STRING}
RewriteRule ^(.*)-t-([0-9]+).html$ articles.php?tPath=$2&%{QUERY_STRING}
RewriteRule ^(.*)-a-([0-9]+).html$ #article_info.php?articles_id=$2&%{QUERY_STRING}
RewriteRule ^(.*)-au-([0-9]+).html$ articles.php?authors_id=$2&%{QUERY_STRING}
RewriteRule ^(.*)-pr-([0-9]+).html$ product_reviews.php?products_id=$2&%{QUERY_STRING}
RewriteRule ^(.*)-pri-([0-9]+).html$ product_reviews_info.php?products_id=$2&%{QUERY_STRING}
RewriteRule ^(.*)-f-([0-9]+).html$ faqdesk_info.php?faqdesk_id=$2&%{QUERY_STRING}
RewriteRule ^(.*)-fc-(.*).html$ faqdesk_index.php?faqPath=$2&%{QUERY_STRING}
RewriteRule ^(.*)-fri-([0-9]+).html$ faqdesk_reviews_info.php?faqdesk_id=$2&%{QUERY_STRING}
RewriteRule ^(.*)-fra-([0-9]+).html$ faqdesk_reviews_article.php?faqdesk_id=$2&%{QUERY_STRING}
RewriteRule ^(.*)-i-([0-9]+).html$ information.php?info_id=$2&%{QUERY_STRING}
RewriteRule ^(.*)-links-([0-9]+).html$ links.php?lPath=$2&%{QUERY_STRING}
RewriteRule ^(.*)-pm-([0-9]+).html$ info_pages.php?pages_id=$2&%{QUERY_STRING}
RewriteRule ^(.*)-n-([0-9]+).html$ newsdesk_info.php?newsdesk_id=$2&%{QUERY_STRING}
RewriteRule ^(.*)-nc-(.*).html$ newsdesk_index.php?newsPath=$2&%{QUERY_STRING}
RewriteRule ^(.*)-nri-([0-9]+).html$ newsdesk_reviews_info.php?newsdesk_id=$2&%{QUERY_STRING}
RewriteRule ^(.*)-nra-([0-9]+).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

As mentioned, I don't know what you changed but it doesn't appear you changed anything for product/article or category so I would expect them to still work.

 

Here are the changes :

 

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-([0-9]+).html$ popup_image.php?pID=$2&%{QUERY_STRING}
RewriteRule ^(.*)-by-([0-9]+).html$ all-products.php?fl=$2&%{QUERY_STRING}
RewriteRule ^(.*)-t-([0-9]+).html$ articles.php?tPath=$2&%{QUERY_STRING}
RewriteRule ^(.*)-a-([0-9]+).html$ #article_info.php?articles_id=$2&%{QUERY_STRING}
RewriteRule ^(.*)-au-([0-9]+).html$ articles.php?authors_id=$2&%{QUERY_STRING}
RewriteRule ^(.*)-pr-([0-9]+).html$ product_reviews.php?products_id=$2&%{QUERY_STRING}
RewriteRule ^(.*)-pri-([0-9]+).html$ product_reviews_info.php?products_id=$2&%{QUERY_STRING}
RewriteRule ^(.*)-f-([0-9]+).html$ faqdesk_info.php?faqdesk_id=$2&%{QUERY_STRING}
RewriteRule ^(.*)-fc-(.*).html$ faqdesk_index.php?faqPath=$2&%{QUERY_STRING}
RewriteRule ^(.*)-fri-([0-9]+).html$ faqdesk_reviews_info.php?faqdesk_id=$2&%{QUERY_STRING}
RewriteRule ^(.*)-fra-([0-9]+).html$ faqdesk_reviews_article.php?faqdesk_id=$2&%{QUERY_STRING}
RewriteRule ^(.*)-i-([0-9]+).html$ information.php?info_id=$2&%{QUERY_STRING}
RewriteRule ^(.*)-links-([0-9]+).html$ links.php?lPath=$2&%{QUERY_STRING}
RewriteRule ^(.*)-pm-([0-9]+).html$ info_pages.php?pages_id=$2&%{QUERY_STRING}
RewriteRule ^(.*)-n-([0-9]+).html$ newsdesk_info.php?newsdesk_id=$2&%{QUERY_STRING} <- fix the bug for newsdesk-info article name
RewriteRule ^(.*)-nc-(.*).html$ newsdesk_index.php?newsPath=$2&%{QUERY_STRING}
RewriteRule ^(.*)-nri-([0-9]+).html$ newsdesk_reviews_info.php?newsdesk_id=$2&%{QUERY_STRING}
RewriteRule ^(.*)-nra-([0-9]+).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

Edited by milerwan

Osc v2.3.4 BS "custom"
PHP 7.3 compatible (710 modified files => o_O')

Link to comment
Share on other sites

  • 3 weeks later...

Hi,

Thanks this addon works beautifully-

I use urlencode(....) in front of my product_id for the actions and links on shopping_cart.php to lead perfectly as my host does not support curly brackets...

 

But the product with attribute URLS seem to redirect to index.php; Please Can you guide me of the fix detail and code that to deal with this hence I could get this working...

 

EXample the url now looks like this in Inspect element:-

http.........................-dress-p-3574%7B2%7D14%7B1%7D17%7B38%7D250%7B43%7D343%7B36%7D241%7B50%7D430%7B51%7D450.html

 

Awaiting your earliest reply

Thanks in advance;

Regds/

Radhavallabh

Edited by radhavallabh
Link to comment
Share on other sites

You will probably need to add the urlencode to the returned url in the html_output file. Fixing code to work for a specific host is usually not a good idea since you may install some addon next weeks that also has to be changed. It's time to look for a new host, in my opinion.

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

@@Jack_mcs

Yes when I switch off the addon the links start working perfectly......

 

I think from your posts elsewhere that you (also) mean:

....../sparkle-curves-deity-metal-earrings-p-3014%7B2%7D15.html

doesn't work, but

....../products_info.php?products_id=3014%7B2%7D15

does.

 

If so, I would infer trouble with the rule in your .htaccess file or with the way the query string substitution works.

Contact me for work on updating existing stores - whether to Phoenix or the new osC when it's released.

Looking for a payment or shipping module? Maybe I've already done it.

Working on generalising bespoke solutions for Quickbooks integration, Easify integration and pay4later (DEKO) integration at 2.3.x

Link to comment
Share on other sites

Hi,

Thank you for your valued response

@@Jack_mcs

Please could you elaborate on how and where to add the urlencode in the html_output file.... It will be of great help. As Changing the host currently will not be possible for me.

 

@@BrockleyJohn

Yes that is what I am trying to imply.... IS it the rules added for SEO addon that may be conflicting with the querystring substitution or Can the query string subtitution be taken care of in a way that it remains compatible with the SEO addon.

I have this in my htaccess

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}

THanks again for helping & guiding me through this... Hope I get this working soon.

 

Regds/

Radhavallabh

Edited by radhavallabh
Link to comment
Share on other sites

@@radhavallabh perhaps you are getting your urls double-encoded. Try

RewriteRule ^(.*)-p-(.*).html$ product_info.php?products_id=$2&%{QUERY_STRING} [NE]

The No Escape parameter should prevent that

Contact me for work on updating existing stores - whether to Phoenix or the new osC when it's released.

Looking for a payment or shipping module? Maybe I've already done it.

Working on generalising bespoke solutions for Quickbooks integration, Easify integration and pay4later (DEKO) integration at 2.3.x

Link to comment
Share on other sites

@@BrockleyJohn

I used that code still it is returnurning the same issue the product URL is redirecting to the index.php  :( ...

 

if you put

<?php
  var_dump($_REQUEST);
  exit();
?>

at the top of product_info.php and then put the SEO url in your browser

[catalog...]/blah-p-3014%7B2%7D15.html

what output do you get?

Contact me for work on updating existing stores - whether to Phoenix or the new osC when it's released.

Looking for a payment or shipping module? Maybe I've already done it.

Working on generalising bespoke solutions for Quickbooks integration, Easify integration and pay4later (DEKO) integration at 2.3.x

Link to comment
Share on other sites

and with the non-SEO url?

[catalog...]/products_info.php?products_id=3014%7B2%7D15

Contact me for work on updating existing stores - whether to Phoenix or the new osC when it's released.

Looking for a payment or shipping module? Maybe I've already done it.

Working on generalising bespoke solutions for Quickbooks integration, Easify integration and pay4later (DEKO) integration at 2.3.x

Link to comment
Share on other sites

one final one, if you revert your .htaccess to the one without [NE] and use the SEO URL?

Contact me for work on updating existing stores - whether to Phoenix or the new osC when it's released.

Looking for a payment or shipping module? Maybe I've already done it.

Working on generalising bespoke solutions for Quickbooks integration, Easify integration and pay4later (DEKO) integration at 2.3.x

Link to comment
Share on other sites

@@BrockleyJohn

I get

array(0) { }

 

ok - they're not double-encoded. In that case they probably need escaping after the rewrite. Try

RewriteRule ^(.*)-p-(.*).html$ product_info.php?products_id=$2&%{QUERY_STRING} [B]

B is for escape backreferences

Contact me for work on updating existing stores - whether to Phoenix or the new osC when it's released.

Looking for a payment or shipping module? Maybe I've already done it.

Working on generalising bespoke solutions for Quickbooks integration, Easify integration and pay4later (DEKO) integration at 2.3.x

Link to comment
Share on other sites

@@BrockleyJohn

Wow it seems it has almost reached to a fix ... (w00t)

 

I tested this URL

http://............dress-p-3573%7B2%7D15%7B38%7D250%7B43%7D343%7B36%7D327%7B50%7D430%7B51%7D450.html

 

The Dump gives below

array(1) { ["products_id"]=> string(44) "3573{2}15{38}250{43}343{36}327{50}430{51}450" }

 

And on click The URL now redirects to...... The Product's page without the attributes

 

http://..........dress-p-3573.html      :thumbsup:

 

I am almost jumping with joy mid way..... Thank you so much..... For helping me to get this far atleast............

:D

Link to comment
Share on other sites

@@BrockleyJohn

I just tested 

With SEO urls off the URL returns with the attributes selected on the product page.....

 

But with SEO URLs on it is redirecting to the product page without the attributes....

 

I just tried it out on a test system for a customer with this addon but who doesn't use attributes. It looks like what you're experiencing is the default behaviour of the addon - you get the same as a site without the curly braces issue. I dare say it's fixable, but will take a little looking into.

Contact me for work on updating existing stores - whether to Phoenix or the new osC when it's released.

Looking for a payment or shipping module? Maybe I've already done it.

Working on generalising bespoke solutions for Quickbooks integration, Easify integration and pay4later (DEKO) integration at 2.3.x

Link to comment
Share on other sites

@@BrockleyJohn

 

Yes I did notice even when I did not use 'urlencode' and the fix ....the products without the attributes redirected to there respective urls perfectly... But products those with attributes redirected to index.php....

 

But now

after using urlencode and your fix....

The products without attributes redirect the same way too and those with attributes are redirecting to the same base urls like the without ones.

Link to comment
Share on other sites

@@radhavallabh go into the SEO settings in admin and set 'Enable automatic redirects?' to false

 

Incidentally, I suspect you could have played with these settings and maybe the special character conversion to avoid making any changes to the code.

Contact me for work on updating existing stores - whether to Phoenix or the new osC when it's released.

Looking for a payment or shipping module? Maybe I've already done it.

Working on generalising bespoke solutions for Quickbooks integration, Easify integration and pay4later (DEKO) integration at 2.3.x

Link to comment
Share on other sites

@@BrockleyJohn

 

(w00t) :thumbsup: :thumbsup: :thumbsup: :D

It is now working like a charm .... No problems at all...... I am so happy Thank you soooo much for helping me finally fix this issue.

I am so grateful just cant express my gratitude enough.

 

Sorry but I may trouble you with One more thing how can I make all the links in shopping cart.php to work as SSL on refresh...

.That is the product link, Remove button, and the Quantity Update button

All refresh the cart to the HTTP version on updating it thereby showing a warning of transferring to a insecure enviroment.

 

Thanks again....

Regards/

Radhavallabh :) :)

Link to comment
Share on other sites

 

@@BrockleyJohn

I use this button for updating quantity how can I add SSL to it so that the warning does not show.....

<div class="shopping_cart_refresh">'. tep_draw_button(IMAGE_BUTTON_UPDATE, 'refresh') . '</div>

 

The problem isn't the button, it's the action on your form - and it's also not related to this addon; you should really create a separate thread for more help with sorting out your cart SSL. However, since I'm already answering it, you should be able to force SSL on the form action in shopping_cart.php with

<?php echo tep_draw_form('cart_quantity', tep_href_link(FILENAME_SHOPPING_CART, 'action=update_product', 'SSL')); ?>

Contact me for work on updating existing stores - whether to Phoenix or the new osC when it's released.

Looking for a payment or shipping module? Maybe I've already done it.

Working on generalising bespoke solutions for Quickbooks integration, Easify integration and pay4later (DEKO) integration at 2.3.x

Link to comment
Share on other sites

@@BrockleyJohn

Sorry for the deviated topic post... :blush: Will surely use a new topic for further ones...... ;) 

 

Thanx for the fix...

Thank you so much for helping me out through this in getting all the stuff working......

I will always be grateful...

 

Warm Regards/

Radhavallabh

:) :thumbsup:

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