簡體   English   中英

無法配置路由Yii?

[英]Can't configure routing Yii?

原諒我這么頻繁的情況,我上網搜索了。 我嘗試過,沒有任何進展。 我無法在Yii中配置路由。 如果有人可以幫助初學者,我將不勝感激:

1)我已經完成了Yii的項目。

2)在/ var / www / html上傳的項目中,我有要數字化的雲,安裝了LAMP。

3)我的/var/www/html/.htaccess

RewriteEngine on

# if a directory or a file exists, use it directly 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d

# otherwise forward it to index.php 
RewriteRule . index.php

4)/var/www/protected/config/main.php

// uncomment the following to enable URLs in path-format
    'urlManager' => array(
        'urlFormat' => 'path',
        'rules' => array(
            '<controller:\w+>/<id:\d+>' => '<controller>/view',
            '<controller:\w+>/<action:\w+>/<id:\d+>' => '<controller>/<action>',
            '<controller:\w+>/<action:\w+>' => '<controller>/<action>',
        ),
        //not show index.php
        'showScriptName' => false,
    ),

5)/var/www/html/protected/.htaccess

deny from all

6)/ var / www / yii中的Yii框架。

如果通過瀏覽器輸入項目的URL,請輸入/ var / www / html /,/ var / www / yii /看不到,這正常嗎? 告訴我如何配置正確的路由? (不帶“ /?r =“)。 文件夾777,文件666 rewrite_module(共享)

好吧,我建議您從( http://www.yiiframework.com/wiki/427/htaccess-seo-friendly-url/ )更改您的.htaccess文件

RewriteEngine on
RewriteBase /
# if a directory or a file exists, use it directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond $1 !^(index\.php)

# otherwise forward it to index.php
RewriteRule ^(.+)$ index.php?$1 [PT,L,QSA]

現在,如果您尚未設置虛擬主機,則應用程序位於/ var / www / html / MySite等文件夾中。 然后將.htaccess中的RewriteBase /MySite更改為RewriteBase /MySite

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM