vhost
ファイルの次のディレクティブは、.htaccess
ファイルがない場合に正常に動作します。しかし、私がそれを紹介するとき、それは働くことを止める。 htaccess
書き換えがnot-matched
の場合に、vhost
書き換えを実行するにはどうすればよいですか? vhost.conf
からディレクトリレベル.htaccess vhost書き換えをmod_rewriteが停止します
:
# Skip everything except html and json
RewriteCond %{REQUEST_URI} \..+$
RewriteCond %{REQUEST_URI} !\.(html|json)$
RewriteRule .* - [L]
# If html exists (is cached)
RewriteRule ^$ index.html [QSA]
RewriteRule ^([^.]+)$ $1.html [QSA]
# Otherwise pass it on the index.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php [QSA,L]
/test/.htaccess
から:/test/hello.json
...
ため
RewriteEngine on
RewriteCond %{REQUEST_URI} old_directory/.*$
RewriteRule (.*)$ old_missing.phtml [PT]
要求... .htaccess
なし:index.php
にルーティングし、正しいJSONを返しています。 .htaccess
と
...:.htaccess
なし...
... /text/old_hello.phtml
ため404 Not Found
要求を返します。.htaccess
で... 404 Not Found
を返します。またold_missing.phtml
の内容を返します。私は書き換えログを書きましたが、.htaccess
のルール(trip per-dir prefix
、applying pattern
、RewriteCond => not-matched
、およびpass through
)を使用している必要があるようですが、それだけで停止します。
「なぜあなたはこれをやっているのですか? 1)私は払い戻しをしています2)いくつかのajax .phtml
リクエストを新しいajax .json
システムに移行していますので、ユーザーがold_directory
のファイルを要求している場合は最初にメッセージを渡す必要があります変更。ありがとう。
私はそれは、単純な何かを知っていました。ありがとう。 –