4

I am pointing everything into /public folder with this .htaccess.

RewriteEngine On RewriteRule ^(.*)$ public/$1 [L] 

It is fine, i can load /administration path without /public, but the problem is, that i can also load it like this /public/administration.

2
  • I have previously answered a very similar question at stackoverflow.com/questions/22075238/…, albeit for Laravel 4 so I don't know if it is still applicable to Laravel 4, but I imagine it is. Commented May 11, 2015 at 15:56
  • I also had same problem with Laravel 5. This solution worked for me. justcode.me/laravel/… Commented Aug 11, 2017 at 13:48

2 Answers 2

2

Try this alternative .htaccess file:

Options +FollowSymLinks RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^ index.php [L] 

Source: Laravel Documentation's §Installation > #Pretty Urls

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

1 Comment

This is .htaccess within /public, i am trying to point from root directly to /public, so i cannot use this .htaccess.
1

If I understand correctly, it looks like your virtual host config is pointing to the directory above public. Why? Do you need it to be this way for some reason?

Laravel should work out of the box with Apache provided your document root is set to the public dir. That's why there's a default .htaccess inside that directory.

6 Comments

Thanks for information, but this is not an answer to my question.
Why isn't it? What's stopping you from changing your document root?
On my localhost i can do it, but on hosting i have got access just only for web. I am trying to achieve this on hosting, on localhost i use artisan serve.
OK, that makes sense. I assume none of the answers here help you: stackoverflow.com/questions/28364496/…
Changing the structure is not recommended, but i have tried it. And i also tried to point with .htaccess.
|

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.