views:

8

answers:

1

Sorry guys if this is a lame question, but the examples i found dont quite work the way I want

What I'm tryint to achive is send any web site request for products to "producto.php" but keeping the descriptive URL for the search engines.

This is the .htaccess I have

RewriteRule ^en/products(/)?$ /en/products/tactical/ [R]
RewriteRule ^es/productos(/)?$ /es/productos/tactico/ [R]

RewriteRule ^en/products/tactical(/)?$ /app/view/productos.php
RewriteRule ^en/products/rescue(/)?$ /app/view/productos.php
RewriteRule ^en/products/diving(/)?$ /app/view/productos.php

RewriteRule ^es/productos/tactico(/)?$ /app/view/productos.php
RewriteRule ^es/productos/rescate(/)?$ /app/view/productos.php
RewriteRule ^es/productos/buceo(/)?$ /app/view/productos.php

This works, but is difficult to maintain. I cannot find how to convert the three ^en/products/tactical(/)?$, ^en/products/rescue(/)?$, ^en/products/diving(/)?$ to just one rule. I could not make it work with the typical /[A-Za-z], probaply because I'm not sure how to use it

+1  A: 
RewriteRule ^en\/products\/([a-zA-Z]+)\/?$ /app/view/productos.php?product=$1

What would pass string between slashes as a parameter.

Tomasz Kowalczyk
This is the way to go, and simple enough
Alex Angelico
I'm happy that you are satisfied. ;]
Tomasz Kowalczyk