2012-01-14 8 views
0

私はhtaccessファイルを/ images、/ css、/ javascripts以外のすべてのトラフィックをcgi-binにリダイレクトさせたいと思っています。 example.com/cgi-bin/index
を取得するためにexample.com/indexが、私はまた、要求したい:私のhtaccessファイルをcgi-binに書き直す方法

RewriteEngine on 
RewriteCond %{REQUEST_URI} !^images/.*$ 
RewriteCond %{REQUEST_URI} !^css/.*$ 
RewriteCond %{REQUEST_URI} !^javascript/.*$ 
RewriteCond %{REQUEST_URI} !^cgi-bin/.*$ 
RewriteRule (.*) /cgi-bin/$1 [L] 

は私が要求したいexample.com/imagesを/foo.png検索するexample.com/images/foo.png

ファイルに問題がありますか?私はこのエラーが発生し続ける:要求は、構成エラーの可能性があるため、10の内部リダイレクトの限界を超えました。

答えて

1

あなたは、彼らが混乱を引き起こしていた、.htaccessファイルにRewriteRuleのために使用すべきではないものの、必要とされるあなたのRewriteCondsのすべての大手/を、欠けています。

RewriteEngine on 
RewriteCond %{REQUEST_URI} !^/images/ [NC] 
RewriteCond %{REQUEST_URI} !^/css/ [NC] 
RewriteCond %{REQUEST_URI} !^/javascript/ [NC] 
RewriteCond %{REQUEST_URI} !^/cgi-bin/ [NC] 
RewriteRule (.*) /cgi-bin/$1 [L] 

また、.*$は不要です。より効率的にするために削除しました。

関連する問題