2010-08-08 2 views
0

을 존중하지 않습니다 내가 루트에 대한 /public_html/ 너무 http://example.com지도를 공유 호스팅을 사용하고mod_autoindex가 나는 유사한 디렉토리 구조가 mod_rewrite는 규칙

public_html/ 
    example.com/ 
    index.php 
    subdir/ 
     file.jpg 

을하고, 나는 이것을 변경할 수 없습니다. (후행 /없이)

내가 http://example.com/subdir로 이동하는 경우
RewriteEngine On 
RewriteRule ^$ example\.com/ [L] 
RewriteRule (.*) example\.com/$1/ [L] 

file.jpg 나열됩니다 만의 URL은 http://example.com/file.jpg 될 것입니다 : 나는이 문제를 처리하는 mod_rewrite는 규칙을 추가했습니다. 상위 디렉토리 링크는 http://example.com/example.com/입니다. http://example.com/subdir/file.jpg : 나는 그것을 적절한 URL을 file.jpg을 나열합니다 (후행 /과) http://example.com/subdir/로 이동하는 경우

. 그러나 상위 디렉터리 링크는 http://example.com/example.com/subdir/입니다.

나는 무슨 일이 일어나고 있는지에 대해 매우 혼란스럽고 이것에 대한 도움을 받고 싶습니다. 나는 다음 http://example.com/example.com/subdir/ 변형로 리디렉션됩니다 /없이 http://example.com/subdir에가는 mod_rewrite는 규칙에 최종 /을 이륙합니다.

은 (또한, 거의 정확한 http://example.com/example.com/-http://example.com/subdir/ 변경의 목록에 대한 상위 디렉토리, 참고하는 것을 .)

답변

1

이것은 비활성화 된 DirectorySlash으로 인해 발생할 수 있습니다. mod_rewrite를 사용하도록 설정하거나이 규칙을 사용하십시오.

RewriteCond %{REQUEST_FILENAME} -d 
RewriteRule .*[^/]$ %{REQUEST_URI}/ [L,R=301] 
관련 문제