这些htaccess规则如何运作?

时间:2012-05-07 03:19:31

标签: .htaccess url-rewriting

我被指示将这些规则放在我的.htaccess文件中,将我网站的请求重定向到子目录,而不在URL中添加子目录,但我无法理解这些规则是如何工作的。有人可以向我解释一下吗?

RewriteEngine on
RewriteCond %{HTTP_HOST} ^(www.)?dinhani.com.br$ [NC]
RewriteCond %{REQUEST_URI} !^/dinhani/
RewriteRule ^(.*)$ /dinhani/$1

1 个答案:

答案 0 :(得分:1)

在伪代码中:

if ($HTTP_HOST is NOT dinhani.com.br NOR www.dinhani.com.br, doing case-insensitive comparisons) {
    if ($REQUEST_URI does NOT start with /dinhani/) {
        change requested URL into /dinhani/original_request_url_here
    }
}