【问题标题】:exclude images folder from redirect rewrite rule从重定向重写规则中排除图像文件夹
【发布时间】:2012-09-15 04:15:40
【问题描述】:

我已经在我的 .htacces 文件中进行了设置,以便任何尝试访问该站点的人都会被重定向到 index.html,这是一个正在建设的页面。我有一张图片,不显示因为链接被重定向到 index.html,我如何从规则中排除图片,路径是 /images/underConstruction.png.

RewriteEngine On
RewriteCond %{REQUEST_URI} !=/index.html
RewriteRule ^ /index.html [R=301]

【问题讨论】:

标签: .htaccess mod-rewrite rewrite


【解决方案1】:

在您的规则中添加排除条件:

RewriteEngine On
RewriteCond %{REQUEST_URI} !=/images/
RewriteCond %{REQUEST_URI} !=/index.html
RewriteRule ^ /index.html [R=301]

【讨论】:

    【解决方案2】:

    尝试添加这一行

    RewriteRule ^images/ - [L]
    

    【讨论】:

    • 如果我把它放在最后一行下面不起作用,如果我把它放在最后一行上面,它是一个重定向循环
    猜你喜欢
    • 1970-01-01
    • 2015-03-21
    • 1970-01-01
    • 1970-01-01
    • 2017-01-11
    • 1970-01-01
    • 1970-01-01
    • 2011-12-23
    • 1970-01-01
    相关资源
    最近更新 更多