【问题标题】:Apache mod_rewrite static resourceApache mod_rewrite 静态资源
【发布时间】:2015-05-18 08:05:36
【问题描述】:

我的“.htaccess”文件在这里。

RewriteEngine On
RewriteRule .* route.php [L]

这是针对 RestURI 的。 我想为我的静态资源定义 RewriteRule 规则在这里。

  1. URI 模式为“^.*/static/.+$”(请求:http://domain/root/static/css/style.css
  2. 如果模式匹配,则来自此位置的响应资源(位置:/static/css/style.css)

我该怎么做?
谢谢。

【问题讨论】:

    标签: apache .htaccess mod-rewrite


    【解决方案1】:

    如果我理解正确:

    RewriteRule ^.*(/static/.*)$ $1 [L,R]
    

    【讨论】:

    • 我解决了这个RewriteRule ^(?:.*/)*static/(.*)$ /static/$1 [L]
    • 有什么区别?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-12-04
    • 2013-08-01
    • 2014-08-29
    • 2014-07-29
    • 1970-01-01
    相关资源
    最近更新 更多