url / mod_rewrite问题

时间:2012-12-28 20:13:11

标签: php apache

我有3个目录级别的页面,城市,类别和业务

e.g。新约克/餐馆/麦当劳。

所以我有city.php,category.php和business.php

e.g。 city.php?url = new-york,category.php?url = new-york / restaurants,and business.php?url = mcdonalds

我将如何创建一个mod_rewrite: / new-york,/ new-york / restaurants和/ mcdonalds

1 个答案:

答案 0 :(得分:0)

试试这个

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-s
RewriteRule ^/new-york/(.*)$ category.php?url=new-york/$2 [L]