You are here:  » htaccess half works

Support Forum



htaccess half works

Submitted by mgmedia on Tue, 2011-04-26 18:10 in

Hi David ,

Having a problem with the htaccess file. Bits of it work, but then other parts don't.

If I click on one of the features products, everything works great. If I click on the merchant from there, it works great and as expected.If I search something and click on that, it works as expected, and again, the merchant works as expected.

Now, if I select browse by merchant, brand or category and then click on something I get a page not found as it completely misses out the merchant, brand or category from the URL.

For example, if I click on a merchant through a product I get:
www.example.co.uk/merchant/name

Yet when I do it though the browse by merchant, brand or category I and I click on either a merchant, or a category I get this:
www.example.co.uk/name

It completely misses out the middle part. Any idea what is causing this? I haven't modified the htaccess file at all and from what I can remember I haven't touched any of the search pages in the html folder.

Thanks

Ben

Submitted by support on Tue, 2011-04-26 18:16

Hi Ben,

It sounds like you are navigating the merchant, category and brand indexes from the non-rewrite versions of:

merchants.php
categories.php
brands.php

When using .htaccess, because of the way the the URLs are constructed hierarchically instead you need to use:

/merchant/
/category/
/brand/

...which will then lead to the correct clear search result page URLs e.g.

/category/Widgets/

The default index.php contains use a PHP "ternary" construct (basically and IF/THEN/ELSE statement but in shorthand) to create the correct URL depending on whether or not $config_useRewrite is true; but if you know you're using rewrite simply modify your template to link to the /merchant/ etc. versions and that should be all it is!

Cheers,
David.
--
PriceTapestry.com

Submitted by mgmedia on Tue, 2011-04-26 18:33

Hi David,

Thanks. I hadn't thought to look in merchants.php etc.

I've changed

 if ($config_useRewrite)
      {
        $item["href"] = urlencode(tapestry_hyphenate($product["merchant"]))."/";
      }

Into this:

 if ($config_useRewrite)
      {
        $item["href"] = "merchant/". urlencode(tapestry_hyphenate($product["merchant"]))."/";
      }

Everything works fine now. Cheers!

Ben

Submitted by mgmedia on Thu, 2011-04-28 16:43

Hi David ,

Found a new problem since turning mod_rewtite on.

When viewing a list of items, if I click to the next page it goes to 2.html as expected, but this in turn searches 2 and so brings up a item not found.

If I click sort by relevance, or price high to low and click on to the next page of products it works fine and I can scroll through as how ever many pages a particular category brings up. If I haven't clicked to sort the page though it all goes wrong when trying to view past page one. This is obviously going to be a big problem.

Any ideas?

Thanks

Ben

Submitted by support on Thu, 2011-04-28 16:56

Hi Ben,

That still sounds like the settings aren't quite in sync. For a normal installation, with clean URLs enabled ($config_useRewrite=TRUE) let's say you install the script into a sub-directory called

/shopping/

Then, in config.php, line 6 should be:

  $config_baseHREF = "/shopping/";

...and in .htaccess, line 5 should be:

RewriteBase /shopping/

In addition, any links to the merchant / category / brand index pages should be to, taking merchant as an example:

/shopping/merchant/

If you're still not sure, if you could email me a link to the installation, an example page where the follow on link (e.g. 2.html) doesn't work, and also attach your config.php and .htaccess I'll check it out for you...

Cheers,
David.
--
PriceTapestry.com

Submitted by mgmedia on Thu, 2011-04-28 20:13

An email is on it's way to you with links and copies of the files. Thank you for looking at this, really appreciate it.

Thanks

Ben