1
私はApache2で.htaccessを使用していますが、うまくいきます。Nginxでrewriteを使うには?
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([A-Za-z0-9_]+)$ profile.php?username=$1
、今私はnginxの書き換えを使用し、サイトで利用可能で、私はこの設定
server {
listen 80;
server_name domain.com;
root /home/domain;
index index.html index.htm index.php;
location/{
rewrite "^([A-Za-z0-9_]+)$" profile.php?username=$1 last;
}
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}
location ~ /\.ht {
deny all;
}
}
を作るが、それは動作しません、それは404が見つかりません示して、あなたは私にエラーを助けることができますか?ありがとう。
{ '、.htaccessファイルでは、'するRewriteCond%{REQUEST_FILENAME}を使用(!-e $ REQUEST_FILENAME)場合は、ここで '使うべき理由を説明することができ、ありがとうございました!-f'と'するRewriteCond% {REQUEST_FILENAME}!-d'。 – yeleko