N
N
naneri2015-01-23 14:10:01
Laravel
naneri, 2015-01-23 14:10:01

How to fix Apache not redirecting requests to Laravel public/index.php?

Already asked a question today, but I could understand what the problem was, though I did not find a solution.
There is a domain like mydomain.com
On the hosting in the folder www/mydomain.com/social there is a project written in Laravel. If you open the main page mydomain.com/social/public - then there are no problems.
But there was a problem that Apache does not redirect requests like mydomain.com/social/public/register to the index.php file and therefore it does not find anything and gives an error:

The requested URL /social/public/register was not found on this server.

Although if you write mydomain.com/social/public/index.php/register - it will process a link of this kind (because Apache redirects it to index.php, and Laravel does the routing itself), but CSS and JS files are not loaded correctly (it turns out links like mydomain.com/social/public/index.php/js/scripts.js , although there shouldn't be index.php).
How to fix this problem? I'm 99% sure that it's Apache that maps requests incorrectly, but I don't understand how to fix it.
.htaccess used like this and it works on local and on other hosting:
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Ilya Shtrykul, 2015-01-23
@MainBrain

Try replacing
with
RewriteRule ^(.*)$ index.php?/$1 [L]

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question