「nginxサーバ」.htaccessファイルを設定するメモ

1.ファイル.htaccessの作成
# nginx rewrite rule
rewrite ^(.*?)/article/.*?-(d+)-(d+).html$  $1/display.html?id=$2&page=$3   break;
rewrite ^(.*?)/category/.*?-(d+)-(d+).html$ $1/listdata.html?id=$2&page=$3   break;
rewrite ^(.*?)/tag/([^/]+)/?$  $1/tag.html?w=$2    break;
rewrite ^(.*?)/tag/([^/]+)/(d+)$    $1/tag.html?w=$2&page=$3    break;
# end nginx rewrite rule

2.nginx.confの修正
# vim  /usr/local/etc/nginx/nginx.conf
下記追加
include /usr/www/.htaccess
nginx再起動
# /usr/local/etc/rc.d/nginx restart

Nginx

Posted by arkgame