2

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.

opalenzuela
  • 3,139
  • 21
  • 41
Priit
  • 422
  • 1
  • 5
  • 15
  • Did you try `RewriteRule ^.*$ index.php [L]` ? – Justin Iurman Feb 03 '14 at 14:35
  • Thanks for the help. Turns out even just adding a slash works "RewriteRule ^ /index.php [L]" Must have lost the [L] in copy paste and that's why I couldn't get it to work before. Now the only thing still bugging out is the trailing slashes part. Works on url's like mysite.com/login/ but gives a redirect loop when mysite.com is visited. – Priit Feb 04 '14 at 07:23
  • @JustinIurman did You delete the answer? Didn't have time to test it. – Priit Feb 05 '14 at 06:20

1 Answers1

2

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]
Justin Iurman
  • 18,954
  • 3
  • 35
  • 54
  • Hy thanks for Your patience. This seems to be really close but instead of last slash it removes the first in the url. So "hostname/login/" becomes "hostnamelogin/". I tried different combinations with the original but no luck. – Priit Feb 06 '14 at 06:33
  • Well this is really weird. Try with my edited answer. If this one does not work, then i don't know – Justin Iurman Feb 06 '14 at 12:07