When I change the mod_rewrite to true i get the following : followed by a 404 error
http://www.shopsort.co.uk/Shop/search.php?q=merchant:Advanced+MP3Players: (without)
http://www.shopsort.co.uk/Shop/Advanced-MP3Players/ (with - 404 error)
So where have I gone wrong ?
DIR = Shop
RewriteBase /Shop/
OK
shopsort.co.uk/Shop/
right ?
That's fine.... but what is generating the URL:
http://www.shopsort.co.uk/Shop/Advanced-MP3Players/
It doesn't have /merchant/ in it; so I don't think it's coming from the Price Tapestry code...
No It is !
I have moved the "merchant" code in to the index, Product and Search pages so that they are there all the time.
It only falls over when I switch it on!
Can you post your modified .htaccess, that will help diagnose...
Options -MultiViews
RewriteEngine On
RewriteBase /Shop/
RewriteRule ^product/(.*).html$ products.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/(.*)/(.*).html$ 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/(.*)/(.*).html$ 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/(.*)/(.*).html$ search.php?q=brand:$1:&page=$2&rewrite=1%{QUERY_STRING} [L]
Hi Eddie,
As you've modified the code to generate different URLs, you will need to make corresponding changes to your .htaccess. As it stands, you are generating the following URL:
/Shop/Advanced-MP3-Players/
However, you haven't made any changes to .htaccess (except for RewriteBase), which is why you are getting a 404 error when you turn on search engine friendly URLs...
eh?
RewriteBase /Shop/ should sort that out?
I have only included the code into other pages!
I'm lost - it was easier before (for me at least)
David any chance of an example please ?
It looks like you need to add the merchant, category and brand prefixes manually because you have moved those indexes into the root directory of your installation rather than the subdirectories.
Previously, you were here:
/
When you click the SE friendly merchant index link you go here:
/merchant/
Then, when you click a merchant name, you go here:
/merchant/Merchant-Name/
Now, what you have done is move your indexes into the top level; so when somebody clicks on a merchant they are actually here:
/
Hense, because you have not made any changes to the code to account for this, the link becomes:
/Merchant-Name/
Therefore, to deal with this you are going to have to put in merchant/ yourself at the point at which you loop through the feeds table and generate the index.
Assuming that you have coppied the code without changes, you will have a line something like this in your custom index page:
<?php
$merchantHREF = str_replace(" ","-",$feed["merchant"])."/";
?>
You need to change this to something like:
<?php
$merchantHREF = "merchant/".str_replace(" ","-",$feed["merchant"])."/";
?>
You will also have to make similar changes to the category and brand indexes.
OK - Got that for the index and all works.
Now in
search.php
I get
http://www.shopsort.co.uk/Shop/merchant/Advanced-MP3Players/Advanced-MP3Players/
}
if ($config_useRewrite)
{
$merchantHREF = "";
}
else
{
$merchantHREF = "search.php?q=merchant:".urlencode($feed["merchant"]).":";
that seems to work on search.php but is that right?
Hi Eddie,
To make the code work in any directory, Price Tapestry generates what are called "Relative URLs".
Within an HTML web page; you can specify a URL in any one of 3 ways:
a) Fully qualified absolute URL, e.g:
http://www.example.com/path/to/page.html
b) absolute URL, e.g:
/path/to/page.html
c) relative URL, e.g:
../page.html
In order to make installation into the subdirectory of another website as straight forward as possible; Price Tapestry generates relative URLs ("c" in the above examples). A relative URL can use the relative directory names ./ and ../ to mean "current directory" and "up one directory" respectively.
Therefore, as you have copied code that is constructing relative URLs into a page that is to be displayed at a different point on the website, the relative URL will no longer work. That's what's causing this to happen:
http://www.shopsort.co.uk/Shop/merchant/Advanced-MP3Players/Advanced-MP3Players/
In this case; you've coppied code that was expecting to be running here:
http://www.shopsort.co.uk/Shop/merchant/
To a page that is now running here:
http://www.shopsort.co.uk/Shop/merchant/Advanced-MP3Players/
ergo, it doesn't work.
As you are writing custom code that is going to be included at various points in the website; meaning that you don't know the URL when you are writing the code, the safest thing you can do is to compute your URLs using $config_baseHREF. What i'd do is this:
<?php
$merchantHREF = $config_baseHREF."merchant/".str_replace(" ","-",$feed["merchant"])."/";
?>
'dat should fix it for you :)
Cheers David! That got it!
Did you get the email about the drop down ?
http://www.shopsort.co.uk/Shop
Can you start a new thread discussing what it is you want to do; I want to keep PT support to the forum - thanks!
If you're not working in your root directory check the value of RewriteBase in your .htaccess. Even then, i'm not sure what's going on here (the second link looks like something you've constructed manually) as it does not use the /merchant/ URL prefix of the search engine friendly URLs created by Price Tapestry...