これがいつも苦労するのですよね…
うまく設定してあげないとデフォルトのパーマリンク以外を使うと
404で表示されません。
nginxの場合は
confファイルで
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
location / { root /var/www/サブディレクトリ; index index.php index.html index.htm; # WordPress パーマリンク設定を利用可能にする if (!-e $request_filename) { rewrite ^.+?(/wp-.*) $1 last; rewrite ^.+?(/.*\.php)$ $1 last; rewrite ^ /index.php last; } # Rewrite FuelPHP if (-f $request_filename) { expires 30d; break; } if (!-e $request_filename) { rewrite ^(.*)$ /index.php?q=$1 last; } # WordPress カスタム パーマネントリンク対応 try_files $uri $uri/ /index.php?q=$uri&$args; location ~ \.php$ { fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME /var/www/サブディレクトリ/$fastcgi_script_name; include fastcgi_params; } } |
こんな感じに設定してあげて
1 |
/etc/init.d/nginx restart |
これで多分OKです!