【问题标题】:Redirect all requests on subfolder to subfolder/index.html with .htaccess使用 .htaccess 将子文件夹上的所有请求重定向到子文件夹/index.html
【发布时间】:2015-05-30 06:32:30
【问题描述】:

目前我正在使用这个 .htaccess:

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

    RewriteEngine On

    RewriteRule ^((?!app/).*)$ /app/$1 [L,NC,R=301,NE]

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

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

我试图让以/app 开头的任何内容都进入应用程序文件夹,但是当我点击/app/debates 时,它会由index.php 文件处理。如果我点击/app,那么它确实会正确路由。

如何修改它以处理所有子 URL?

【问题讨论】:

    标签: .htaccess mod-rewrite redirect laravel laravel-4


    【解决方案1】:

    正下方插入此规则RewriteEngine On 行:

    RewriteRule ^app/ - [L,NC]
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-12-07
      • 1970-01-01
      • 2017-03-06
      • 2014-06-17
      • 1970-01-01
      • 1970-01-01
      • 2017-12-05
      • 1970-01-01
      相关资源
      最近更新 更多