2011-10-20 3 views
0

나는 이것을위한 해결책을 찾지 못했습니다. 여러 개의 가상 디렉터리를 갖고 싶지만 PHP 나 변수를 사용하지 않고서는 어떻게 할 수 없는지 찾아보십시오. 예를 들면 다음과 같습니다.변수가없는 mod_rewrite 가상 디렉터리

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 

등등. 동적 콘텐츠가 없습니다. 나는 모든 파일을 가지고있다.

답변

2

mod_rewrite을 사용해보세요. 귀하의 의견

RewriteEngine on 
RewriteRule ^restaurant/?$ restaurant.php [L] 
RewriteRule ^restaurant/menu/?$ restaurant-menu.php [L] 
RewriteRule ^restaurant/location/?$ restaurant-location.php [L] 
+0

감사합니다,하지만 임가 오류를 받고 여기까지 가지 일 : 한다 RewriteRule^레스토랑/$의 restaurant.php [L]에 한다 RewriteEngine 하지만 다음 줄을 추가 할 때 RewruteRule^restaurant/menu /? $ restaurant-menu.php [L] 내부 서버 오류가 500 번 발생하고 이전에 작동했던/restaurant/link조차도 그렇게하지 않습니다. –

+0

@Hacienda Misne soory, 그것을 확인하십시오! – undone

+0

마지막 하나는 다음과 같아야합니다 :'RewriteRule^restaurant/location /? $ restaurant-location.php [L]'? 더 많은 가상 디렉토리가 있다면'RewriteRule^restaurant/([^ /] *) /? $ restaurant- $ 1.php [L]'로 마지막 2를 대체 할 수도 있습니다. –