Mod url在.htaccess中编写规则

Need help to create mod url write rules in .htaccess

http://example.com/marketplace/cat/subcat/?city=dubai&area=ajman http://example.com/marketplace/cat/subcat/dubai/ajman where Cat and subcat will change according to category and sub category.

Try this in your .htaccess

RewriteEngine On

RewriteCond %{THE_REQUEST} /marketplace/([^/]+)/([^/]+)/\?city=([^&]+)&area=([^&\s]+) [NC] 
RewriteRule ^ /marketplace/%1/%2/%3/%4? [NE,NC,R,L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^marketplace/([^/]+)/([^/]+)/([^/]+)/([^/]+)/?$ /marketplace/$1/$2/?city=$3&area=$4 [QSA,L,NC]

This should to do what you want

  RewriteEngine On
  RewriteBase /
  RewriteRule ^marketplace/cat/subcat/[a-zA-Z0-9_-]+/[a-zA-Z0-9_-](/?)$ /marketplace/cat/subcat/?city=$1&area=$2 [NC,L]