2017-01-09 77 views
0

我的Web服務器上有zf2,我無法更改Apache中的啓動位置。我將.htaccess複製到public_html上,在/public/index.php上更改了路徑,但是我遇到了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

這是正常的託管,我不能編輯Apache文件,但我在.htaccess中,它運作良好。謝謝 – Sewek