.htaccesslaraveliis-6iirf

Laravel .htaccess mod_rewrite rules on IIS6 with IIRF


Can anyone help me to get Laravel php frameworks default .htaccess mod_rewrite file converted for IIS6 with IIRF isapi plugin?

Laravel default .htaccess

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

    RewriteEngine On

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

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

IIRF does not seem to like the simple "^ index.php" part and everything else I have tried fails in one way or another.


Solution

  • With your explanation and after your comment, this should fix your issues:

    RewriteEngine On
    
    # Redirect Trailing Slashes...
    RewriteRule ^/?(.+)/$ /$1 [R=301,L]
    
    # Handle Front Controller...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^.*$ /index.php [L]