简体   繁体   中英

url/mod_rewrite issue

I have 3 directory levels of pages, city, category and business

eg new-york/restaurants/mcdonalds.

So I have city.php, category.php and business.php

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

How would I create a mod_rewrite that will make: /new-york, /new-york/restaurants, and /mcdonalds

Try this

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM