NYCPHP Meetup

NYPHP.org

[nycphp-talk] mod_rewrite problem

Henry Ponce henry at beewh.com
Mon Apr 19 18:55:27 EDT 2004


Hello all:

I'm working on site that uses mod_rewrite to handle urls. I hope someone can 
help me with a problem I'm having. I read A LOT trying to find the answer, I 
guess my brain too tired.

What I need to do is the following....
whenever someone goes to
www.mydomain.com/yachts/argument1/argument2.html

make this .php script handle it:
www.mydomain.com/yachts/section.php?lang=arg1&section=arg2

This works now with this in my htaccess file:
RewriteEngine On
RewriteRule   ^yachts/([^/]+)/([^/]+)\.html$ 
/yachts/section.php?lang=$1&section=$2

The problem is that I want this to happen ONLY when arg1 is one of the 
following:
en
es
fr
de
sw
it

And when arg2 is one of the following:
yachts
charter
boatyards
service
specials

I read that I have to use RewriteCond in my .htaccess file. This is what I 
have and it doesn't work.

RewriteEngine On
RewriteCond %{REQUEST_URI} 
!^yachts/(en|es|fr|sw|de|it)/(yachts|charter|boatyards|service|specials)\.html
RewriteRule   ^yachts/([^/]+)/([^/]+)\.html$ 
/yachts/section.php?lang=$1&section=$2


Thank you and any help anybody can give is appreciated.
Henry

PS: sorry if the email is too long, I wanted to explain everything clearly.



More information about the talk mailing list