You are here:  » Create SEO Friendly URLs


Create SEO Friendly URLs

Submitted by Tobix on Mon, 2023-04-24 08:04 in

Hi I would like the URLs that we have something like:
www.example.com/categoria/nome_prodotto/ how can I do it?

Submitted by support on Mon, 2023-04-24 09:24

Hello Tobix,

To create product URLs in that format, first edit .htaccess and add the following new rule to the end of the file (that is important as it is a catch-all rule)

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/(.*)/$ products.php?q=$2&rewrite=1&%{QUERY_STRING} [B,L]

Then edit includes/tapestry.php and look for the following code at line 66:

      return $config_baseHREF."product/".urlencode(tapestry_hyphenate($product["normalised_name"])).".html";

...and REPLACE with:

      return $config_baseHREF.urlencode(tapestry_hyphenate($product["category"]))."/".urlencode(tapestry_hyphenate($product["normalised_name"]))."/";

Hope this helps!

Cheers,
David.
--
PriceTapestry.com

Submitted by Tobix on Mon, 2023-04-24 12:45

hello done but nothing has changed

Submitted by support on Mon, 2023-04-24 12:50

Hi Tobix,

Could you be seeing cached pages? Could you try CTRL+F5 to force a reload and see if the links change to the new format?

Cheers,
David.
--
PriceTapestry.com

Submitted by Tobix on Mon, 2023-04-24 13:54

no unfortunately they do not change. do i need to update the feeds?

Submitted by Tobix on Mon, 2023-04-24 14:15

I have this link so far:
{link saved}

I would like it to be {link saved}

Submitted by support on Mon, 2023-04-24 16:07

Hi Tobix,

Ah - that indicates that you don't yet have $config_useRewrite enabled in config.php. To enable search engine friendly URLs you need to change line 6 as follows:

  $config_useRewrite = TRUE;

That should be all it is!

Cheers,
David.
--
PriceTapestry.com

Submitted by Tobix on Tue, 2023-04-25 16:39

Yessss! You are Big! :)

Submitted by Tobix on Thu, 2023-04-27 06:36

I don't know why but with this change the merchant page can no longer be seen. What could have happened?

Submitted by support on Thu, 2023-04-27 08:09

Hi Tobix,

Do the /category/ and /category/Category-Name/ (and similar for brand pages) still work?

Does /merchant/ on it's own work (Merchant A-Z) but it is merchant page e.g. /merchant/Merchant-Name/ that is not working?

Can you check that .htaccess has these rules starting at line 11:

RewriteRule ^merchant/$ merchants.php
RewriteRule ^merchant/(.*)/$ search.php?q=merchant:$1:&rewrite=1&%{QUERY_STRING} [B,L]
RewriteRule ^merchant/(.*)/(.*).html$ search.php?q=merchant:$1:&page=$2&rewrite=1&%{QUERY_STRING} [B,L]

Thanks,
David.
--
PriceTapestry.com

Submitted by Tobix on Thu, 2023-04-27 08:35

Hello in the htaccess file the string didn't fit and added it.

The category works. Brand and Merchant don't work.

Individual merchants work:
{link saved}

Submitted by support on Thu, 2023-04-27 08:59

Hi Tobix,

That's strange - can you copy the complete .htaccess including the modifications from above and I'll double check for you...

Cheers,
David.
--
PriceTapestry.com

Submitted by Tobix on Thu, 2023-04-27 09:47

{code saved}

Submitted by support on Thu, 2023-04-27 10:01

Hi Tobix,

Ah - all it is, the new rules for your clean /category/product-name/ rewrite needs to be the last rule in the file because it is a catch-all (therefore it is stopping the other rules from working properly). So it's these new lines;

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/(.*)/$ products.php?q=$2&rewrite=1&%{QUERY_STRING} [B,L]

...either move them right to the very end of the file, or to keep them with the other rules put it just above this comment in your version;

# caching 1 settimana (in secondi)

Cheers,
David.
--
PriceTapestry.com

Submitted by Tobix on Thu, 2023-04-27 10:47

Nothing works.
Now I noticed that the comments section is not working.

I wrote to the hosting let's see if they blocked them... surely something went wrong when I changed the URLs?

Submitted by support on Thu, 2023-04-27 12:59

Hi Tobix,

Please could you email me your latest .htaccess and includes/tapestry.php and I'll double check everything is matched up with the URLs being generated by the script and your .htaccess file...

Thanks,
David.
--
PriceTapestry.com