Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

skoobi's avatar
Level 13

.htaccess and Vagrant

Im not sure why its happening but I have followed the Get off MAMP tutorial and everything works but as soon as i try and navigate my laravel app it comes up with 404 Not Found. If i then put index.php after the address then the route it works. Ive checked that mod_rewrite is enabled and thats ok and its the .htaccess that comes with Laravel. I have setup different hosts for different projects one is /var/www/laravel-tut/public_html which is set in the .conf file in sites-enabled. and the others follow the file structure...

If searched and tried all the solutions i found but none of them worked. Any ideas or help would be greatful...

Cheers Chris

0 likes
8 replies
bashy's avatar

Would need more info on your DocumentRoot and your config for the site. If you post that, we'll be able to help better.

skoobi's avatar
Level 13

Ah i'll take a look at that tutorial tonight...

Heres my laravel-tut.conf file in the sites-available:

    ServerName laravel.tut
    ServerAdmin webmaster@localhost
    DocumentRoot /var/www/laravel-tut/public_html

    # Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
    # error, crit, alert, emerg.
    # It is also possible to configure the loglevel for particular
    # modules, e.g.
    #LogLevel info ssl:warn

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

    # For most configuration files from conf-available/, which are
    # enabled or disabled at a global level, it is possible to
    # include a line for only one particular virtual host. For example the
    # following line enables the CGI configuration for this host only
    # after it has been globally disabled with "a2disconf".
    #Include conf-available/serve-cgi-bin.conf

Is it the apache2.conf settings your looking for??

Thanks for your responses so far..

bashy's avatar

Okay well that looks fine but where's the Options part? .htaccess probably isn't enabled.

If you're installing Vagrant and a VM manually, you should really check out Homestead or (my preferred) Vaprobash http://fideloper.github.io/Vaprobash/

skoobi's avatar
Level 13

Ill check them tonight and hopefully that will help.. Many thanks for all your help

bashy's avatar

Used Vaprobash a lot on three machines, works all the time and easy to add sites. Can also easily map a port so you can view sites from LAN (other machines).

Give me a shout/mention if you need help -> @bashy

skoobi's avatar
Level 13

Ah that sounds better it's handy checking some apps on another machine. I did find this if anyone followed the 'Getting off MAMP' Tutorial. https://gist.github.com/JeffreyWay/af0ee7311abfde3e3b73
This has the walkthrough for setting up multiple sites which work.

But after setting up Vaprobash im glad i found that solution after otherwise id not have found Vaprobash :)

Please or to participate in this conversation.