2017-01-09 3 views
0

웹 서버에 zf2가 있는데 Apache에서 시작 위치를 변경할 수 없습니다. /httaccess/public/index.php에서 경로가 변경된 public_html로 복사했지만 CSS 스타일 및 js에 문제가 있습니다. .htaccess에서 오류없이 만들 수 있습니까?Zf2 변경 시작 위치

htaccess로 :

RewriteEngine On 
# The following rule tells Apache that if the requested filename 
# exists, simply serve it. 
RewriteCond %{REQUEST_FILENAME} -s [OR] 
RewriteCond %{REQUEST_FILENAME} -l [OR] 
RewriteCond %{REQUEST_FILENAME} -d 
RewriteRule ^.*$ - [L] 
# The following rewrites all other queries to index.php. The 
# condition ensures that if you are using Apache aliases to do 
# mass virtual hosting or installed the project in a subdirectory, 
# the base path will be prepended to allow proper resolution of 
# the index.php file; it will work in non-aliased environments 
# as well, providing a safe, one-size fits all solution. 
RewriteCond %{REQUEST_URI}::$1 ^(/.+)/(.*)::\2$ 
RewriteRule ^(.*) - [E=BASE:%1] 
RewriteRule ^(.*)$ %{ENV:BASE}/public/index.php [L] 
+0

.htaccess를 표시 할 수 있습니까? –

+0

게시물 – Sewek

+0

이 (가) 편집되었으며 문제점은 무엇입니까? 좀 더 정확하게 할 수 있습니까? –

답변

0

로컬 개발 환경에있는 경우 변경할 필요가 없습니다 .htaccess 전혀 @bartek_zet 말했듯이 가상 호스트를 만드는 경우.

그래서 기본 .htaccess 파일을 사용하고 같은 가상 호스트 생성 : ZF2 documentation에서

# usually stored in /etc/apache/site-enabled/my-application.conf 
<VirtualHost *:80> 
    ServerName zf2-tutorial.localhost 
    DocumentRoot /path/to/zf2-tutorial/public 
    SetEnv APPLICATION_ENV "development" 
    <Directory /path/to/zf2-tutorial/public> 
     DirectoryIndex index.php 
     AllowOverride All 
     Order allow,deny 
     Allow from all 
    </Directory> 
</VirtualHost> 

더 많은 정보를.

+0

우리는 아파치 파일을 편집 할 수 없지만 .htaccess 파일로 만들었고 정상적으로 작동합니다. 감사 – Sewek