Hi David,
It's been a while, hope you are well?
Is it a reasonable simple proceedure to remove the .html from the end of all the url's.
Thanks,
Simon
Hi David,
Thanks for that.
The .htaccess file did not like simply removing the .html and it had to be replaced by a \ in order for it not to show an error. The product line now looks like this but it is still not working
RewriteRule ^(.*)\$ products.php?q=$1&rewrite=1&%{QUERY_STRING} [L]
Thanks,
Simon
Hi Simon,
Could you email a link to the search results generating the new links; your current .htaccess, search.php and products.php and i'll check it all out for you...
Cheers,
David.
Hi Dave,
I have removed all .html all works well apart from page sort how do i go about removing .html from page sort?
Kind Regards
Darren
Hi Darren,
When changing the sort, the links go to the non-rewritten pages so .html shouldn't appear in the URL. Could you post an example of a URL that is being generated on your site that is not working, and the modified RewriteRule(s) and I'll take a look for you...
Cheers,
David.
Hi Dave,
so far i have this in the url of pages and sort?
http://www.bargainshack.co.uk/category/Office-Machines/2
but on filter results by i have this?
http://www.bargainshack.co.uk/search/priceAsc/Office-Machines%20/2
the above seems wrong to me i made a mistake some where i think
Kind Regards
Darren
Hi Darren,
Thanks - could you also email me your .htaccess and I'll check it out for you...
Cheers,
David.
Hi David,
I'm not sure what has changed since this thread was created, but I am struggling to remove .html from my URL strings.
I have amended .htaccess accordingly, and the product pages are working fine. However, since I cannot locate and remove any ".html" code in the pages listed above, my search results are still including it, resulting in broken URLs.
Any ideas?
Thanks,
Marc.
Hello Marc,
In the latest distribution the product page URL generation is centralised, so you only need to make one change; in tapestry.php look for the following code at line 53:
return $config_baseHREF."product/".urlencode(tapestry_hyphenate($product["normalised_name"])).".html";
...and REPLACE with:
return $config_baseHREF."product/".urlencode(tapestry_hyphenate($product["normalised_name"]));
Hope this helps!
Cheers,
David.
--
PriceTapestry.com
Hi David,
This worked great - thanks.
However, I'm not having any luck with pagination URLs, in face neither URLs work (with or without .html).
Additionally, any idea how to best create a 301 redirect in .htaccess? I'm using this, but it's not working;
RewriteRule ^product/(.*)$ products.php?q=$1&rewrite=1&%{QUERY_STRING} [L,R=301]
Thanks,
Hello Marcos,
In reverse order; to 301 (Moved Permanently) old .html product URLs to the new version, rather than modify the existing rule (which is still required), insert a new rule immediately prior to it as follows:
RewriteRule ^product/(.*).html$ product/$1 [L,R=301]
RewriteRule ^product/(.*)$ products.php?q=$1&rewrite=1&%{QUERY_STRING} [L]
Regarding pagination, just to confirm do you mean the follow on pages of search results by index e.g.
/merchant/2.html
...you want to be just:
/merchant/2
Thanks.
David.
--
PriceTapestry.com
Hi David,
Thanks for the 301 rule.
Yes that is correct, currently neither version of the URL works.
Hi Marcus,
It sounds like there may now be a conflict between the changed /product/ rules and the index pagination - could you post your full .htaccess (I'll remove if necessary before publishing your reply) and I'll check it out...
Thanks,
David.
--
PriceTapestry.com
Options -MultiViews
Options +FollowSymlinks
RewriteEngine On
RewriteBase /software/
RedirectMatch 301 ^/software/$ /
RewriteRule ^product/(.*).html$ product/$1 [L,R=301]
RewriteRule ^product/(.*)$ products.php?q=$1&rewrite=1&%{QUERY_STRING} [L]
RewriteRule ^review/(.*)$ reviews.php?q=$1&rewrite=1&%{QUERY_STRING} [L]
RewriteRule ^merchant/$ merchants.php
RewriteRule ^merchant/(.*)$ search.php?q=merchant:$1:&rewrite=1&%{QUERY_STRING} [L]
RewriteRule ^merchant/(.*)-(.*)$ search.php?q=merchant:$1:&page=$2&rewrite=1&%{QUERY_STRING} [L]
RewriteRule ^category/$ categories.php
RewriteRule ^category/(.*)$ search.php?q=category:$1:&rewrite=1&%{QUERY_STRING} [L]
RewriteRule ^category/(.*)-(.*)$ search.php?q=category:$1:&page=$2&rewrite=1&%{QUERY_STRING} [L]
RewriteRule ^brand/$ brands.php
RewriteRule ^brand/(.*)$ search.php?q=brand:$1:&rewrite=1&%{QUERY_STRING} [L]
RewriteRule ^brand/(.*)-(.*)$ search.php?q=brand:$1:&page=$2&rewrite=1&%{QUERY_STRING} [L]
Thanks Marcos,
I can see from the code the structure you would like to create - this will require changes in both the rule order and html/navigation.php; so to save you having to keep checking back as I will have to check this out on my test server first please could you email me your:
.htaccess
html/navigation.php
You may want to roll-back your .htaccess to just the /product/ rule changes in the mean time so that your site is fully functional and I will get back to you as soon as I have worked the changes as per the posted version for you...
Cheers,
David.
--
PriceTapestry.com
Hi Simon,
Sure - first off it's just a case if removing the .html from each of the RewriteRules in .htacces; and then removing the equivalent code throughout the script where .html is appended to the product name or used to create the page links for the search results (I assume you want to remove .html from these also).
Since .html always appears as a string, I would suggest a simple search and replace in the following files:
index.php
products.php
reviews.php
search.php
sitemap.php
...searching for:
".html"
...replacing with:
""
(INCLUDING the quotes in this case - because you're searching for a PHP string!)
Cheers,
David.