我在看从旧网站我们的老开发商做了这个规则,我也从来没见过。
I am looking at this rule from an old site one of our old developers did, and I have never saw it.
RewriteEngine On RewriteCond %{HTTP_HOST} ^(www.)?domain$ [NC] RewriteCond %{REQUEST_URI} ^/extension1/(.*)$ [OR] RewriteCond %{REQUEST_URI} ^/extension2/(.*)$ [OR] RewriteCond %{REQUEST_URI} ^/extension3/(.*)$ RewriteRule ^(.*)$ - [L,R=404]
我看到,如果我去域与这些扩展的一个,它只是404的。
I see that if I go to the domain with one of those extensions, it just 404's.
我认为正在发生的事情是,如果它的主机相匹配,与extenions之一,它只是404的。我明白了一切到最后一行,因为 - 抛出我送行。
What I think is happening is if it matches the host, and one of the extenions, it just 404's. I understand everything up to the last line because the - throws me off.
什么的 - 做的最后一条规则
What does the - do in the last rule?
感谢
推荐答案在 - 表示通过传递URI,什么也不做。它本质上不执行任何到URI和仅适用的标志,在这种情况下,返回404
The - means "pass the URI through and do nothing". It essentially does nothing to the URI and only applies the flags, which in this case returns a 404.
有关更多信息,请参见 mod_rewrite的文档下 - (破折号)
For more info, see the mod_rewrite documentation under "- (dash)"
一个破折号表示没有替代应该执行(现有路径是通过非接触传递)。这用于当一个标志(见下文)需要在不改变路径要施加
A dash indicates that no substitution should be performed (the existing path is passed through untouched). This is used when a flag (see below) needs to be applied without changing the path.
更多推荐
连字符.htaccess文件重写规则
发布评论