.htaccess mod_重写没有变量的虚拟目录

.htaccess mod_重写没有变量的虚拟目录,.htaccess,mod-rewrite,.htaccess,Mod Rewrite,我还没有想出解决这个问题的办法。我想拥有多个虚拟目录,但如果不使用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/

我还没有想出解决这个问题的办法。我想拥有多个虚拟目录,但如果不使用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
等等,没有动态内容;我有所有的文件。

你可以用mod_rewrite来做


感谢您的输入,但我收到了一个错误,直到这里一切正常:RewriteEngine on RewriteRule ^restaurant/?$restaurant.php[L]但当我添加下一行RewruteRule ^restaurant/menu/?$restaurant-menu.php[L]时,我收到500个内部服务器错误,甚至以前有效的/restaurant/link也停止这样做了。@Hacienda Misne soory,看看吧!最后一个不应该是:RewriteRule^restaurant/location/?$restaurant-location.php[L]?如果有更多虚拟目录,您还可以使用RewriteRule ^restaurant/[^/]*/?$restaurant-$1.php[L]替换最后2个。
RewriteEngine on
RewriteRule ^restaurant/?$  restaurant.php [L]
RewriteRule ^restaurant/menu/?$  restaurant-menu.php [L]
RewriteRule ^restaurant/location/?$  restaurant-location.php [L]