Search code examples
.htaccesslaravelmod-rewritededicated-server

resolving index.php issue at url laravel htaccess


I know this question is asked alot and there are alot of answers on "how to resolve index.php issue in laravel".

However, I tried multiple ways in order to solve it from .htaccess on live dedicated server with WebsitePanel in order to remove index.php from URL. I tried a couple of ways however let me describe the issue here, index.php not only have changed the url, but also some of the css and javascript stuff are not loaded as well while most of them are loaded, CSS seems pretty fine but fonts are also changed.

It was working well at a shared host but here in a dedicated host it has alot of problems.

Is there a .htaccess code to solve this issue? and does index.php affects on CSS and is it normal?

my current htaccess is as follow:

<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
    Options -MultiViews
</IfModule>

RewriteEngine On

# Redirect Trailing Slashes...
RewriteRule ^(.*)/$ /$1 [L,R=301]

# Handle Front Controller...

Options +FollowSymLinks

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ /index.php [L]
</IfModule>

Solution

  • For IIS Windows Server, the .htaccess needs to be translated to web.config and this works like a charm. here is the link: How to enable modrewrite on IIS Web Server

    In case Someone needed this in future!