2017-01-09 12 views
0

Webサーバーにzf2があり、Apacheの起動場所を変更できません。 /public/index.phpのパスが変更された.htaccessを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

ローカル開発環境である場合は、@bartek_zetが言ったように、仮想ホストを作成する場合は、全く.htaccessを変更する必要はありません。

ので、デフォルト.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

私はApacheのファイルを編集することはできませんが、.htaccessで作ったので、うまくいきます。ありがとう – Sewek

関連する問題