我还没有想出一个解决方案。我想拥有多个虚拟目录但却无法在不使用PHP或某种变量的情况下找到它。例如,我想:
mysite.com/restaurant/ to point to mysite.com/restaurant.php
mysite.com/restaurant/menu/ to point to mysite.com/restaurant-menu.php
mysite.com/restaurant/location/ to point to mysite.com/restaurant-location.php
依此类推,没有动态内容;我有所有文件。
答案 0 :(得分:2)
你可以使用mod_rewrite
来做到这一点!
RewriteEngine on
RewriteRule ^restaurant/?$ restaurant.php [L]
RewriteRule ^restaurant/menu/?$ restaurant-menu.php [L]
RewriteRule ^restaurant/location/?$ restaurant-location.php [L]