데비안 리눅스 9. 아파치 2.4.2 아파치는 표준 저장소와 mod_rewrite로부터 설치되었습니다.mod_revite가 Apache에서 작동하지 않는 이유는 무엇입니까?
사이트의 루트는 /var/www/mysite입니다. 가상 호스트 local-mysite.ru이이 디렉토리로 구성됩니다.
처음에는 phpinfo()를 호출하여 루트 index.php 파일을 작성했습니다. 이 출력을 확인했습니다 :로드 된 모듈 섹션에서 mod_rewrite를 볼 수 있습니다. 좋아.
다음으로 테스트 사이트의 압축을 풉니 다. 다음 스크립트는 다음 URL에서 열립니다 시작 : 너무 정상, http://local-mysite.ru/appadv/frontend/web 이 URL에하는 열립니다 http://local-mysite.ru/appadv/frontend/web/index.php
을 지금, 나는 브라우저가 http://local-mysite.ru를 열 때, URL로 리디렉션을 따라하는 것이 필요 http://local-mysite.ru/appadv/frontend/web . 이를 위해
,이 내용으로 htaccess로 쓴 :
Options +FollowSymLinks
IndexIgnore */*
RewriteEngine on
# If the request does not start with the web, we add it
RewriteCond %{REQUEST_URI} !^/(appadv/frontend/web)
RewriteRule (.*) /appadv/frontend/web/$1
# If the file or directory does not exist, go to /web/index.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /appadv/frontend/web/index.php
내가 온라인 테스터 http://htaccess.madewithlove.be에서 그를 시험했다. 변환 URI가 올바르게 진행됩니다.
하지만 내 호스트 URI 변환이 발생하지 않습니다!
LogLevel warn rewrite: trace4
재부팅 아파치 : 디버깅을위한
, 나는 리디렉션 메시지를 볼 수 /etc/apache2/apache2.conf 파일의 옵션을 편집했다. URL이 http://local-mysite.ru 인 페이지를 업데이트했습니다. 필자가 이해하는 한, [rewrite ...] 또는 이와 유사한 것으로 표시된 줄은 /var/log/apache2/error.log 파일에 나타납니다. 그러나 그런 것은 없습니다.
어디서 더 파야할지 모르겠다.
중요 사항 : URL이 http://local-mysite.ru 인 경우 Apache는 파일 목록을 표시합니다.