Support the ongoing development of Laravel.io →
Configuration Requests Installation
Last updated 2 years ago.
0

I always see that if mod_rewrite line - is it possible you don't have apache configured with mod_rewrite? therefor none of the rewrite conditions would work?

0

mod_rewrite is indeed enabled, but it does seem that the rewrite conditions are simply not being considered.

0

I solved this after some digging around and this is out there in different forms of solutions, but here is mine for other noobs out there that might struggle with figuring it out:

On Apache 2.4.7 then the default config is to use the /var/www/ to put your website html ie. your laravel install. The apache2.conf is also set to not allow .htaccess override by setting AllowOverride None like this

<Directory /var/www/>
	Options Indexes FollowSymLinks
	AllowOverride None
	Require all granted
</Directory>

Well you can change this by changing the apache2.conf, but this is not recommended due to the chance of it being overwritten by apache2 upgrades, etc. Instead of changing this then it is recommended to do this override in the VirtualHosts file for your site ie. sites-available/yoursite.com.conf

In this file then you need the above directive with the value for the directory right into your public folder on Laravel ie. /var/www/html/yoursite.com/laravelappinstall/public It should look something like this:

<Directory /var/www/html/yoursite.com/laravelappinstall/public/>
	Options Indexes FollowSymLinks
	AllowOverride All
	Require all granted
</Directory>

Put that in yoursite.com.conf (Virtual Hosts config), make sure your .htaccess from in that folder looks just like the one from the Laravel install documentation Pretty URLs

Make sure that you have enabled the rewrite module ie. sudo a2enmod rewrite

Restart your web server ie. sudo service apache2 restart

And voila! You should be back in business with pretty url's. It is at least what finally worked for me and puts all of the info that I needed to find in different threads and piece together to finally make sense of what was going on. Hope it might help another noob!

Long live Laravel!

0

Thank you @iGitK72. This worked like a charm !

0

Sign in to participate in this thread!

Eventy

Your banner here too?

iGitK72 igitk72 Joined 15 Sep 2015

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.