AnchovyLegend AnchovyLegend - 1 year ago 36
PHP Question

All routes causing 404

We are trying to go live with our Laravel project on an Ubuntu server running Apache. While all routes and functionality works locally, after going live, all routes that are not the home route result in a 404 error.

I am using the default laravel .htaccess in the /public directory.

My

/etc/apache2/sites-available
looks as follows:

<VirtualHost *:80>
ServerName mydomain.com
ServerAlias www.mydomain.com

ServerAdmin [email protected]
DocumentRoot /var/www/html/mydomain.com/public
<Directory /var/www/mydomain.com/public>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
Allow from all
</Directory>

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


The
/mydomain.com/
root directory does not currently contain any .htaccess.

I enabled modrewrite using
a2enmod rewrite
and restarted apache after every change.

Has anyone else run into this issue? I appreciate any suggestions on how to resolve.

Thanks in advance!

Answer Source

You write mydomin.com in every rows. But later you talk about mydomain.com folder. (Note the A). Is it just a mistyping?

Update: The problem is an other mistyping: directories should be the same on the following lines:

    DocumentRoot /var/www/html/mydomain.com/public
    <Directory /var/www/html/mydomain.com/public>
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download