例如,在商店中,我有类别和产品。类别形成为
localhost/categories.php?categoryid=***
其中 categoryid 可以是任何单词。
产品形成为
localhost/products.php?categoryid=***&productmanufactor=***&productname=***
where categoryid
,productmanufactor
也productname
可以是任何词
所以我想从(示例)重写:
localhost/car
除了localhost/categories.php?categoryid=car
某些词(关于、联系人等)
和
localhost/car/audi/r8
到
localhost/products.php?categoryid=car&productmanufactor=audi&productname=r8
这怎么能轻松完成?
htaccess
RewriteEngine On
RewriteBase /
RewriteRule ^about$ about.php [NC,L]
RewriteRule ^contact$ contact.php [NC,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ categories.php?categoryid=$1 [NC,L]