views:

27

answers:

1

How can I create the mod_rewrite rule so I can convert the following URLs:

From: domain/something/param/action ex:domain/cities/Chicago/view

to: domain/something/action.php?param1=param ex: domain/cities/view.php?city=Chicago

Changing to cities/view/Chicago cannot be an alternative.

Thanks in advance.

A: 

Think this will work (don't have access to a server at present to check I'm afraid):

RewriteRule ^([a-zA-Z]+)/([a-zA-Z]+)/([a-zA-Z]+)$ /$1/$3.php?city=$2

Any use? This assumes your domain is the root of the server eg http://www.example.com/cities/Chicago/view

richsage