Reputation: 1475
I'm using Bitnami MampStack on OS X 10.9. Because this is an inherited laptop, I had to set up Apache under MAMP to listen on port 8888. I tweaked it to listen on 8889 as well and added the following as a VirtualHost in my httpd.conf
file:
<VirtualHost *:8889>
DocumentRoot "/Applications/mampstack-5.4.26-0/apache2/htdocs/codebright/public"
ServerName localhost
<Directory "/Applications/mampstack-5.4.26-0/apache2/htdocs/codebright/public">
Require all granted
</Directory>
</VirtualHost>
I followed the example here (so all my source code matches his). The index blade works, but the edit
, create
, and delete
blades return a 404.
As I was testing, I discovered that http://localhost:8889/create
returned a 404, but http://localhost:8889/index.php/create
returned the correct view. Also, browsing http://localhost:8888/codebright/public/create
works as expected.
So...me being kinda new to Laravel and MVC frameworks in general, is there some way I can have this installing running properly on port 8889?
Upvotes: 1
Views: 3217
Reputation: 87719
Your virtualhost is working as it should, you just have now to be sure your public/.htaccess file is in place:
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
# Redirect Trailing Slashes...
RewriteRule ^(.*)/$ /$1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
This is the file that rewrites your urls removing the /index.php
from them.
EDIT
Also, check if you have mod_rewrite installed and enabled, because your .htaccess
uses it, in Ubuntu/Debian, to enable it, you have to execute:
sudo a2enmod rewrite
Upvotes: 1
Reputation: 1475
Figured it out, thanks to this. I was missing AllowOverride All
in the <Directory>
section. Updated httpd.conf
:
<VirtualHost *:8889>
DocumentRoot "/Applications/mampstack-5.4.26-0/apache2/htdocs/codebright/public"
ServerName localhost
<Directory "/Applications/mampstack-5.4.26-0/apache2/htdocs/codebright/public">
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
I thought I might have been missing RewriteEngine On
in the VirtualHost
definition but it doesn't seem to have an effect on my problem.
Upvotes: 0