-1

I'm using laravel routes, and I have a problem with URL

for example

https://laracasts.com/discuss. - URL has a double https://laracasts.com/index.php/discuss

how to fix it?enter image description here

1 Answers1

0

If it isn't already there, create an .htaccess file in the Laravel root directory. Create a .htaccess file your Laravel root directory if it does not exists already. (Normally it is under your public_html folder)

Now you should be able to access the website without the "/public/index.php/" part.

Edit the .htaccess file so that it contains the following code:

<IfModule mod_rewrite.c>
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]
</IfModule>
  • 1
    I don't like this solution. this implies that your web server's document root corresponds to your base path which can be very dangerous in terms of security – simonecosci Jul 23 '19 at 13:26
  • 1
    possible duplicate of https://stackoverflow.com/questions/4365129/htaccess-remove-index-php-from-url – simonecosci Jul 23 '19 at 13:28
  • I have .htaccess like laravel repository. So i havent problem with DocumentRoot. I have a problem with URL. I think its decision on for me https://stackoverflow.com/questions/4365129/htaccess-remove-index-php-from-url – Владислав Битмарев Jul 23 '19 at 15:08