Laravel .htaccess mod_rewrite规则在IIS6上使用IIRF

时间:2014-02-03 14:31:52

标签: .htaccess laravel iis-6 iirf

任何人都可以帮我拿到Laravel php框架的默认.htaccess mod_rewrite文件转换为IIS6与IIRF isapi插件吗?

Laravel默认.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似乎不喜欢简单的“^ index.php”部分,而我尝试的其他所有内容都以某种方式失败。

1 个答案:

答案 0 :(得分:2)

根据您的解释和评论后,这应该可以解决您的问题:

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]