NYCPHP Meetup

NYPHP.org

[nycphp-talk] mod_rewrite problem

putamare jeffknight at mac.com
Mon Apr 19 19:08:53 EDT 2004


Keep it simple. Use the basic mod-rewrite and then have the php  
destination file redirect on any invalid parameters.

On Apr 19, 2004, at 6:55 PM, Henry Ponce wrote:

> 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.
> _______________________________________________
> talk mailing list
> talk at lists.nyphp.org
> http://lists.nyphp.org/mailman/listinfo/talk
>
jeff.knight not junkmail at nyphp.org




More information about the talk mailing list