2015-08-26 66 views
0

我在訪問高級主題的後端部分時遇到問題。基本上我無法訪問前端部分的.htaccess中進行更改。 在根文件夾中的.htaccess是:Yii2高級主題後端訪問

RewriteOptions inherit 
Options -Indexes 
RewriteEngine on 

<IfModule mod_rewrite.c> 
    RewriteCond %{REQUEST_URI} !^/frontend/web/(assets|css|stylesheets|images|js)/ 
    RewriteCond %{REQUEST_URI} !admin 
    RewriteRule .* frontend/web/index.php [L] 
</IfModule> 

RewriteEngine on 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule . index.php 
+0

您還需要在.htaccess中配置後端規則。查看http://stackoverflow.com/questions/28118691/yii2-htaccess-how-to-hide-frontend-web-and-backend-web-completely –

回答

0

當您啓用在任一frontend/backend應用yii2-上級篇模板漂亮的URL組件,請確保您創建一個。相應的應用程序的Web文件夾下的文件htaccess包含以下內容

# use mod_rewrite for pretty URL support 
RewriteEngine on 
# if a directory or a file exists, use the request directly 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
# otherwise forward the request to index.php 
RewriteRule . index.php 

注:rewrite_module應在Apache中啓用這個工作。