I came up with this problem, after setting up a fresh server. the laravel putting an index.php right after the localhost when I click a route. e.g localhost/index.php/mysite/public/login.
how to remove the index.php
after the localhost?
Asked
Active
Viewed 1,178 times
1
-
https://stackoverflow.com/questions/37507209/how-to-hide-config-files-from-direct-access – Alexey Mezenin Jul 25 '17 at 06:51
-
same result. everytime i click on something its still redirecting with index.php – Ctrlex Jul 25 '17 at 07:05
-
This means you didn't setup web server correctly or you didn't restart it. – Alexey Mezenin Jul 25 '17 at 07:12
-
i have restarded it but this happens, localhost/index.php/index.php/index.php/...................../mysite/public/login – Ctrlex Jul 25 '17 at 07:18
-
actually the system is working when im running the php artisan serve, what i did to run the system without serve is i run this code (php artisan serve -host 0.0.0.0) – Ctrlex Jul 25 '17 at 07:26
1 Answers
0
Make sure you have .htaccess file inside of your public folder with below code:
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ /$1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
</IfModule>

Parth Vora
- 4,073
- 7
- 36
- 59