You are here:  » Issue With .html


Issue With .html

Submitted by brentmitchell on Mon, 2011-08-29 19:10 in

In Wordpress, a page or post isn't an .html file, so why do my product pages end with .html? What about that trailing slash after it too? Is there a way to get rid of this...better yet, can we customize how our links show up on our sites? Thanks for your help!

{link saved}

Submitted by support on Mon, 2011-08-29 20:10

Hi Brent,

The product pages are created dynamically by the plugin under a URL that is intended to be identical to the product page URLs generated in a standalone installation of Price Tapestry. Products are not actually imported as posts; however it would be straight forward to adjust the dynamically generated product page URLs as you mentioned - perhaps if you could post an example of the sort of product page URL you would like to use I'll work out the changes for you - this is something that could also be configurable to a greater extent than simply changing the /product/ base HREF so I'll also consider that...

Regarding the trailing slash issue, as more users have started running the beta i'm coming across this more often so I'm currently investigating and will post a fix for this very shortly!

Cheers,
David.

Submitted by brentmitchell on Mon, 2011-09-05 07:33

Hi David,

I think the best product page URL would just list the product id or product name....is that what you are asking? Really, anything would be suitable vs what it currently is set at...

Submitted by support on Mon, 2011-09-05 09:03

Hi Brent,

It's straight forward to remove .html from the product pages. In pto_common.php you'll find this code at line 31:

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

REPLACE that with:

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

Finally, in pto.php look for the following code at line 299:

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

Submitted by Mark Hennessy on Thu, 2014-01-02 11:23

Hi David,

I too am looking to remove the .html from my product pages. Is all of the above still current or do I also need to make some changes in my .htaccess file?

Thanks

Submitted by support on Thu, 2014-01-02 11:26

Hi Mark,

No changes to .htaccess required for this mod when using the plugin - the "rules" are all internal to WordPress rather than actual htaccess rules...

Cheers,
David.
--
PriceTapestry.com

Submitted by Mark Hennessy on Fri, 2014-01-10 13:56

Hi David,

Everything worked ok, the .html was removed.

I am however getting duplicate content warnings on my moz.com reports. It seems Google is still indexing .html links for the time being.

Is there anything I can place in the .htaccess for a short while to stop the duplicate content until Google fully indexes the newer non .html links?

Submitted by support on Fri, 2014-01-10 15:13

Hi Mark,

After the RewriteBase line, the following should do the trick:

If your new product URLs are

/product/Product-Name/

(e.g. ending in "/")

...then use:

RewriteRule ^product/(.*).html/$ product/$1/ [L,R=301]

..otherwise if the new URLs are

/product/Product-Name

...then use:

RewriteRule ^product/(.*).html$ product/$1 [L,R=301]

This will issue a 301 (Moved Permanently) from the old to the new URLs.

Cheers,
David.
--
PriceTapestry.com

Submitted by Mark Hennessy on Tue, 2014-01-14 12:53

In case anyone wants to know, I also managed to change the review pages, which if followed above still show .html

Even though my review pages are not indexed via my robots.txt, for completeness I wanted it removed from them.

I made the same simple changes from the lines above, only on the productreview versions, which were the next lines down.

Submitted by support on Tue, 2014-01-14 12:56

Thanks Mark!

Cheers,
David.
--
PriceTapestry.com