重写-仅排除php文件


REWRITING - Exclude only php files

我真的需要你关于mod_rewriting和条件的帮助。

对于我的工作,我必须为静态文件制定一个简单的规则。如果它是一个静态文件,我只需要在url中添加一个"statics/"。

我试过这个:

    RewriteCond %{QUERY_STRING} !^(.*)'.php$
    RewriteRule ^(.*)  /product/cerberep/sources/statics/$1 [L]

它适用于:-index.php?name=测试-js/test.js但是,如果我在查询字符串中得到另一个点,我会得到一个404错误。例如:-index.php?file=test.js正如您所看到的,这是一个带有另一个点的php文件。

你能帮我只排除php文件吗?请:)

您根本不想在这里与查询字符串匹配。

RewriteRule !'.php$ /product/cerberep/sources/statics%{REQUEST_URI} [L]