Garbare
2957
24
Servers

URLs only work when '/index.php/' is used

Posted 3 years ago by Garbare

I have just launched a Laravel 5 project on a live server and all is going well except for one thing.

I need to write /index.php/ in the url to access any page other than the home page.

For example

sitename/                   -- this works fine

sitename/index.php          -- this also works fine

sitename/about              -- This causes a server 404

sitename/index.php/about        -- this works fine

I suspect this is an issue with the .htaccess file but I'm a little out of my comfort zone in this area.

Here is the .htacccess I'm using.

<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]
</IfModule>

This is the .htaccess that came with the install. I haven't changed anything. (Any changes have been reverted.)

Does anyone have any insight into this?

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

Reply to

Use Markdown with GitHub-flavored code blocks.