You are here:  » How do we remove .html and also make URLS lowercase


How do we remove .html and also make URLS lowercase

Submitted by twdesigns on Mon, 2011-12-19 22:49 in

Hi I was looking at the standard version but it doesn't seem to work anymore for changing URLs to \ instead of .html. I would also like to make all my URLS lowercase.

Thanks in advance,
Tommy

Submitted by support on Tue, 2011-12-20 09:57

Hi Tommy,

The product urls are generated by the pto_common_productHREF() function in pto_common.php. In that file, look for the following code at line 48:

return get_bloginfo('url').$pto_config_productBaseHREF.pto_common_hyphenate($product->normalised_name).".html";

...and REPLACE with:

return get_bloginfo('url').$pto_config_productBaseHREF.pto_common_hyphenate(strtolower($product->normalised_name));

Finally, this must be matched by the rewrite rule that handles the product URLs. In pto.php, look for the following code at line 285:

$newrules['('.trim($pto_config_productBaseHREF,'/').')/(.*).html$'] = 'index.php?pagename='.$pto_config_permalink.'&pto_module=product&pto_product=$matches[2]';

...and REPLACE with:

$newrules['('.trim($pto_config_productBaseHREF,'/').')/(.*)$'] = 'index.php?pagename='.$pto_config_permalink.'&pto_module=product&pto_product=$matches[2]';

Cheers,
David.
--
PriceTapestry.com

Submitted by twdesigns on Tue, 2011-12-20 15:48

Thank you David! How can I make all my URLS small now?

Thanks again,
Tommy

Submitted by support on Tue, 2011-12-20 16:39

Hi Tommy,

For the merchant/category/brand indexes; to lower case the URLs look for the following code at line 107 in pto_atoz.php

$itemURL = get_bloginfo('url').$$baseHREFVar."/".pto_common_hyphenate($row->$module);

...and REPLACE with:

$itemURL = get_bloginfo('url').$$baseHREFVar."/".pto_common_hyphenate(strtolower($row->$module));

Cheers,
David.
--
PriceTapestry.com

Submitted by twdesigns on Tue, 2011-12-20 16:54

Thank you! Works great!

Submitted by twdesigns on Thu, 2012-03-08 17:42

One other question. If I click on a category and use the navigation links I get www.XXXXXX.com/category/cycling/9.html/ for example. Where do I remove the trailing slash and also change it so that it looks like /category/cycling/9/ ?

Submitted by support on Thu, 2012-03-08 18:21

Hi,

Check your permalink settings at wp-admin > Settings > Permalinks. It sounds like you're using a format with the trailing "/" which is therefore being added automatically. If the format you want is correct apart from that, copy the format as a "Custom" permalink format and remove the trailing slash in your custom version - that should do the trick...

Cheers,
David.
--
PriceTapestry.com

Submitted by twdesigns on Thu, 2012-03-08 20:16

That was it! Thank you. Now where do I edit to remove the .html from the navigational links when viewing categories? As in the example above.

Submitted by support on Fri, 2012-03-09 08:57

Hi Tommy,

A couple of changes; firstly in pto.php look for the following code beginning at line 273:

  $newrules[$m.'/(.*)/(.*).html$'] = 'index.php?pagename='.$pto_config_permalink.'&pto_q=merchant:$matches[1]:&pto_page=$matches[2]';
  $newrules[$c.'/(.*)/(.*).html$'] = 'index.php?pagename='.$pto_config_permalink.'&pto_q=category:$matches[1]:&pto_page=$matches[2]';
  $newrules[$b.'/(.*)/(.*).html$'] = 'index.php?pagename='.$pto_config_permalink.'&pto_q=brand:$matches[1]:&pto_page=$matches[2]';

...and REPLACE with:

  $newrules[$m.'/(.*)/(.*)$'] = 'index.php?pagename='.$pto_config_permalink.'&pto_q=merchant:$matches[1]:&pto_page=$matches[2]';
  $newrules[$c.'/(.*)/(.*)$'] = 'index.php?pagename='.$pto_config_permalink.'&pto_q=category:$matches[1]:&pto_page=$matches[2]';
  $newrules[$b.'/(.*)/(.*)$'] = 'index.php?pagename='.$pto_config_permalink.'&pto_q=brand:$matches[1]:&pto_page=$matches[2]';

Next, in pto_search.php, use the Search and Replace feature of your text editor to replace each instance of

".html"

(including the quotes!!)

with:

""

..and that should do it..!

Cheers,
David.
--
PriceTapestry.com

Submitted by twdesigns on Mon, 2012-03-12 15:03

That did it! Thanks!