4

I tried to make Laravel works on my environment (MAMP) but i'm stuck in this situation.

The index.php file of Laravel is into a subfolder called "public", so if I want to test my application I need to access it with this url http://localhost/laravel/public/ but I want access with http://localhost/laravel

I tried to set an htaccess with this rows but it doesn't work:

<IfModule mod_rewrite.c>  
    RewriteEngine on
    RewriteRule ^(.*)$ public/$1
</IfModule>  

I'm not sure that this htaccess can resolves this situation, I get a 404 generated by Lavarel.

3 Answers 3

6

You need to create a virtualhost. Dayle Ress covers this in the first chapter in his Laravel book: https://web.archive.org/web/20121013083457/http://daylerees.com/2012/03/25/laravel-getting-started/

Sign up to request clarification or add additional context in comments.

Comments

4

Put .htacess file in root with code:

<IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteCond %{REQUEST_URI} !^public
    RewriteRule ^(.*)$ public/$1 [L]
</IfModule>

Comments

0

public is actually the part that should be your document root.

1 Comment

In my testing environment I have every sites in locahost/ folder

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.