0

I'm trying to deploy my Laravel project on Google Cloud VM, it did directing to my index.php file but it supposed to routing to the controller instead of showing the index.php code line.

Here is the result

Then i try to change the .htaccess file like the code below:

<IfModule mod_rewrite.c>
    <IfModule mod_negotiation.c>
        Options -MultiViews -Indexes
    </IfModule>

    RewriteEngine On

    #I'm adding this code
    RewriteRule ^(.*)$ public/$1 [L]

    # Handle Authorization Header
    RewriteCond %{HTTP:Authorization} .
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

    # Redirect Trailing Slashes If Not A Folder...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_URI} (.+)/$
    RewriteRule ^ %1 [L,R=301]

    # Send Requests To Front Controller...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]

</IfModule>

And here is the result

After that i remove that line and try to change all the 'AllowOverride None' lines to 'AllowOverride All' inside of apache2.conf file, then remove the lines that prevent .htaccess and .htpasswd files from being viewed by Web clients:

<FilesMatch "^\.ht">
        Require all denied
</FilesMatch>

But the result is still same like the first result

And then i'm trying to add this line:

<IfModule dir_module>
    DirectoryIndex index.html index.php
</IfModule>

inside of apache2.conf file but then again the result is still same like the first result

I already install Composer inside of the project but it still not working.

Thank you.

P.S: Sorry for my bad English.

  • 1
    Check if [mod_php](https://stackoverflow.com/questions/2712825/what-is-mod-php) is enabled in apache. – Tpojka Apr 28 '20 at 17:00
  • @Tpojka thanks for your response! I followed the instruction in this [link](https://stackoverflow.com/questions/17407517/disable-mod-php-in-vhosts-and-activate-suphp) and even uninstall it, but it seems not working as well. – Shabadoobee Apr 28 '20 at 17:54
  • @Tpojka is right, there's something wrong with `mod_php`. Probably you should try preconfigured solution like "LAMP Certified by Bitnami" because "It includes SSL auto-configuration with Let's Encrypt certificates, and the latest releases of PHP, Apache, and MySQL on Linux. This application also includes phpMyAdmin, PHP main modules, Zend, Symfony, CodeIgniter, CakePHP, and Laravel frameworks." from Marketplace. – Serhii Rohoza Apr 29 '20 at 09:51
  • @SerhiiRohoza Thank you, i try to reinstall LAMP and make a whole new Laravel Project, and it's working! But the problem now is for my main Project that i clone form BitBucket, it's always facing internal server error. I already add the .env file anda re-configure the configuration file, but it always ended up with that error. – Shabadoobee May 01 '20 at 06:36

0 Answers0