calin.ionut
2 weeks ago
132
6
Laravel

laravel app using index.php in url

Posted 2 weeks ago by calin.ionut

I have a website in laravel which is installed on a vps server using apache.

The virtualhost file for it is:

<VirtualHost *:80>
    ServerAdmin [email protected]
    ServerName example.com
    ServerAlias www.example.com
    DocumentRoot /var/www/example.com/public

    <Directory /var/www/example.com/public/>
    Options Indexes FollowSymLinks MultiViews
    AllowOverride All
        Require all granted
    </Directory>

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined   
RewriteEngine on
RewriteCond %{SERVER_NAME} =www.example.com [OR]
RewriteCond %{SERVER_NAME} =example.com
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>

The problem that i discovered today is if i use in the url /index.php it still loads the homepage (even if I don`t have that route defined)

the homepage route is:

Route::any('/', '[email protected]')->name('homepage')

Why is this happening? Is there a setting in laravel to prevent this ?

Please sign in or create an account to participate in this conversation.