アプリケーションをApacheからNginXに移動しようとしていますが、.htaccessファイルを書き直す必要があることがわかりました。よく調べましたが、最終的に助けを求める必要があります。
以下はApacheの.htaccessファイルです。/html、/css、/images、/phpへのリクエストを除いて、すべてのリクエストをindex.phpにリダイレクトしようとしています。
事前にご協力いただきありがとうございます。明細書
RewriteEngine on
RewriteRule ^html [L,NC]
RewriteRule ^css [L,NC]
RewriteRule ^images [L,NC]
RewriteRule ^php [L,NC]
RewriteRule ^.*$ index.php [L,QSA]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !directory/(.*)$
RewriteCond %{REQUEST_URI} !(.*)$
RewriteRule ^(.*)$ http://www.domain.com/$1 [R=301,L]
これまでのところ、以下があり、html、css、画像、および php ファイルの要求はうまく機能しています。
しかし、私が www.domain.com/blah/blah/blah/ をリクエストすると 404 が返されます。私が本当に必要としているのは、URL を www.domain.com/blah/blah/blah/ としてリーミングすることですが、 index.php ファイル
location ~ directory/(.*)$ {
}
location ~ (.*)$ {
}
location /html {
rewrite ^/html / break;
}
location /css {
rewrite ^/css / break;
}
location /images {
rewrite ^/images / break;
}
location /php {
rewrite ^/php / break;
}
location / {
rewrite ^(.*)$ /index.php break;
if (!-e $request_filename){
rewrite ^(.*)$ http://www.domain.com/$1 redirect;
}
}