Associate
- Joined
- 15 Feb 2006
- Posts
- 1,872
- Location
- hell
Hi
I'm trying to build a php driven site with rewritten URLs. I have the done the basics and have rewritten URLs working on my site.
The problem I now have is that I want to sort my data, and since you have to use the query string to do this, you end up having a very large htaccess file (which you have to write manually).
Example
I have a page listing 9 products out of 100 products.
I have a sorting navigation where users can select products by Gender, Type, Price, Colour. Users can also press "View All" to see all 100 products.
The URL that displays 9 products is:
www.domain.com/product
When the user clicks "Mens" from the sorting navigation, the URL changes to www.domain.com/product/gender/mens and my htaccess file instructs that "mens" should be considered part of the gender variable in the query string.
Now if on the mens product page, they press "color = red" the URL changes to
www.domain.com/product/gender/mens/color/red and htaccess file instructs that color variable should be red.
My PHP page has the relevant queries set up that see if color/gender etc is set().
now the issue is, to my (basic) knowledge, you have to rewrite regular expressions in the correct order. So for example i have to have both: color/([^/]+)/gender([^/]+) and gender([^/]+)/color([^/]+) set up in my htaccess to drop the words in the correct variables.
This gets extremely complex if you throw other sorts into the mix - depending on the user journey, the URL is different
www.domain.com/color/red/gender/ladies/speed/fast
www.domain.com/speed/fast/color/red/gender/ladies
www.domain.com/gender/ladies/color/red/speed/fast etc etc all have to be accounted for in the htaccess.
BTW
I'm using a script that takes the current URL of my page, and appends the relevant /gender etc onto the end for the creation of links on my page.
Can anyone assist me with this dilema?
I want to make the sort work like www.asos.com (clothes shopping site). YOu can sort by various things - they don't use rewritten URLs though so it's a LOT easier?
I'm trying to build a php driven site with rewritten URLs. I have the done the basics and have rewritten URLs working on my site.
The problem I now have is that I want to sort my data, and since you have to use the query string to do this, you end up having a very large htaccess file (which you have to write manually).
Example
I have a page listing 9 products out of 100 products.
I have a sorting navigation where users can select products by Gender, Type, Price, Colour. Users can also press "View All" to see all 100 products.
The URL that displays 9 products is:
www.domain.com/product
When the user clicks "Mens" from the sorting navigation, the URL changes to www.domain.com/product/gender/mens and my htaccess file instructs that "mens" should be considered part of the gender variable in the query string.
Now if on the mens product page, they press "color = red" the URL changes to
www.domain.com/product/gender/mens/color/red and htaccess file instructs that color variable should be red.
My PHP page has the relevant queries set up that see if color/gender etc is set().
now the issue is, to my (basic) knowledge, you have to rewrite regular expressions in the correct order. So for example i have to have both: color/([^/]+)/gender([^/]+) and gender([^/]+)/color([^/]+) set up in my htaccess to drop the words in the correct variables.
This gets extremely complex if you throw other sorts into the mix - depending on the user journey, the URL is different
www.domain.com/color/red/gender/ladies/speed/fast
www.domain.com/speed/fast/color/red/gender/ladies
www.domain.com/gender/ladies/color/red/speed/fast etc etc all have to be accounted for in the htaccess.
BTW
I'm using a script that takes the current URL of my page, and appends the relevant /gender etc onto the end for the creation of links on my page.
Can anyone assist me with this dilema?
I want to make the sort work like www.asos.com (clothes shopping site). YOu can sort by various things - they don't use rewritten URLs though so it's a LOT easier?