yii 无法找到请求的页面“”,

nzk0hqpo  于 2022-11-09  发布在  其他
关注(0)|答案(2)|浏览(127)

我正在使用Yii 1,并将其移动到AWS。
在我的服务器上Yii安装在/var/www/html
当我转到我的URL时,出现404错误。
下面是我的/etc/apache2/sites-available/000-default.conf文件

<VirtualHost *:80>

                ServerAdmin webmaster@localhost
                DocumentRoot /var/www/html/frontend/www

                ErrorLog ${APACHE_LOG_DIR}/error.log
                CustomLog ${APACHE_LOG_DIR}/access.log combined

 </VirtualHost>

而我的.htaccess文件位于我的/var/www/html/frontend/www

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /html/frontend/www/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /html/frontend/www/index.php [L]
</IfModule>

你知道我错过了什么吗?谢谢

u2nhd7ah

u2nhd7ah1#

我在我的/etc/apache2/sites-available/000-default-le-ssl.conf中添加了这个

<Directory /var/www/html>
    Options Indexes FollowSymLinks
    AllowOverride all
    Order allow,deny
    allow from all
    Require all granted
</Directory>

这个在我的.htaccess里

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]

现在它的工作,我可以查看子目录在我的网址

ca1c2owp

ca1c2owp2#

<VirtualHost *:80>
        DocumentRoot /var/www/html/frontend/www
        <Directory /var/www/html/frontend/www>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride All
                Order allow,deny
                allow from all
        </Directory>
</VirtualHost>

HTTP访问

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

检查你的index.php是否被调用?

相关问题