0

Apache .htaccess ルールを追加したい。これは古いサーバーのnginxからのものです:

    location ~ \.php$ {
    fastcgi_split_path_info ^(.+\.php)(/.+)$;
            fastcgi_pass unix:/var/run/php5-fpm.sock;
    fastcgi_index index.php;
    include fastcgi_params;
}

    location / {
    if (-f $request_filename) {
        break;
    }
    if (-d $request_filename) {
        break;
    }
    rewrite ^/(.*) /index.php?demand=$1;
}

これをどう書き直すか。私が今得ているのはインデックスページだけで、残りのファイルは見つかりません。ここで助けてもらえることを本当に望んでいます、ありがとう。

4

2 に答える 2

1

書き換え部分は次のようになります。

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php?demand=$1 [L]

https の使用を強制するには、上記のルールの前にこれを追加します。

RewriteCond %{HTTPS} off
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
于 2013-10-06T00:24:08.340 に答える