Reputation: 761
I am able to access my Laravel site with mysite.com/
routing correctly with / retrieving the welcome view.
I am able to access files in my public directory such as
mysite.com/img/test.jpg
But when I try to access any other routes, such as mysite.com/login
.
I get the following error
Not Found
The requested URL /contact was not found on this server.
It looks like the application is trying to access another route that is not hitting index.php
to generate the view accordingly.
I am using the default .htaccess
file that Laravel comes with.
My apache conf file points to my public directory.
Anyone run into a similar issue before?
Upvotes: 0
Views: 2611
Reputation: 5386
I faced same issue and I did everything that was mentioned in different articles but issue was still there
sudo a2ensite rewrite
update conf file located at /etc/apache2/sites-available/example.conf
<Directory /var/www/html/project/public>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
then restarted server using sudo service apache2 restart
After doing all above steps issue was still there then I changed apache2.conf file and everything was working fine.
In
/etc/apache2/apache2.conf
change just 3rd line as shown below
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride None //change this line to AllowOverride All
Require all granted
</Directory>
After that I did not have to add ../index.php/...
in the urls
Upvotes: 2
Reputation: 15464
May be you need to enable mod rewrite
sudo a2enmod rewrite
Restart Apache.
sudo service apache2 restart
Follow the tutorial on the link below
Upvotes: 0