skip to Main Content

I’m using Yii 1, and moving it to AWS.

On my server Yii is installed in /var/www/html

When I go to my URL, I get a 404 error.

below is my /etc/apache2/sites-available/000-default.conf file

<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>

And my .htaccess file is located in my /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>

Any idea what I’m missing or doing wrong here? Thank you

2

Answers


  1. Chosen as BEST ANSWER

    I added this in my /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>
    

    and this in my .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]
    

    now it works, and i can view sub directories in my url


  2.     <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>
    

    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
    

    check your index.php is called or not?

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search