1

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?

Antonio Carlos Ribeiro
  • 86,191
  • 22
  • 213
  • 204
tmountjr
  • 1,423
  • 2
  • 22
  • 38

2 Answers2

1

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
Antonio Carlos Ribeiro
  • 86,191
  • 22
  • 213
  • 204
  • The `.htaccess` file is already there and matches what's listed here. Is there something in the virtualhost configuration I'm missing? – tmountjr Mar 11 '14 at 01:51
  • Since you dont have to add /public in your, your virtual host is working as it should, it's really the rewrite that's seems not working. Check if you have mod_rewrite installed and enambed, just edited to show you how to enable it, because usually it is already installed. – Antonio Carlos Ribeiro Mar 11 '14 at 13:07
0

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.

Community
  • 1
  • 1
tmountjr
  • 1,423
  • 2
  • 22
  • 38