0

下面是我的要求,

来自http://subdomain.example.com的任何请求都应该重写以执行http://subdomain.example.com/script.php

但是任何请求都直接来自http://subdomain.example.com/script.php不应该在其他任何地方重定向/重写。

我怎样才能在不结束重写循环的情况下做到这一点?

4

1 回答 1

1

any request that comes to http://subdomain.example.com should rewrite to execute http://subdomain.example.com/script.php.

But any request comes directly to http://subdomain.example.com/script.php should not be redirected/rewrite anywhere else.

If I understood right, you may try this in one .htaccess file at subdomain.example.com root directory:

Options +FollowSymlinks -MultiViews
RewriteEngine On
RewriteBase /
RewriteRule ^$    /script.php         [L,NC]

Not only the requests to script.php will be excluded from the rule and passed through, but any other request with something in the URI-path as it has to be empty for the rule to be used.

于 2013-04-16T00:22:54.500 回答