2017-08-23 9 views
0

URLのリダイレクトに問題があります。 そして、なぜリダイレクトコマンドに従わない唯一のURLなのか分かりません。wwwのないリダイレクトはURLには機能しません

私はすべてのURLをwwwで開けたいと思います。

プラットフォーム:

  • のWordPress 4.8.1
  • サーバー:nginxの - Ubuntuの14.04.5 LTS
  • 簡単エンジンで行わインストール

注:私が持っていますすでにこれらのすべてを行った 手順:https://easyengine.io/tutorials/nginx/www-non-www-redirection/

ありがとうございました!

https://www.example.org/ Redirecting to www (yes) 
http://www.example.org/ Redirecting to www (yes) 
https://example.org/ Redirecting to www (no) This is the problem url 
http://example.org/ Redirecting to www (yes) 

BLOCKネームサーバ

server { 
    server_name www.example.org example.org; 

    access_log /var/log/nginx/example.org.access.log rt_cache; 
    error_log /var/log/nginx/example.org.error.log; 

    root /var/www/example.org/htdocs; 

    index index.php index.html index.htm; 

    include common/php.conf; 
    include common/wpcommon.conf; 
    include common/locations.conf; 
    include /var/www/example.org/conf/nginx/*.conf; 

} 

FORCEのSSL

server { 
listen 80; 
     server_name www.example.org example.org; 
     return 301 https://www.example.org$request_uri; 
} 

TEST

~# nginx -t 
    nginx: the configuration file /etc/nginx/nginx.conf syntax is ok 
    nginx: configuration file /etc/nginx/nginx.conf test is successful 

TESTリダイレクトURL

~# curl -I https://example.org 
HTTP/1.1 200 OK 
Server: nginx 
Date: Wed, 23 Aug 2017 19:45:46 GMT 
Content-Type: text/html; charset=UTF-8 
Connection: keep-alive 
Vary: Accept-Encoding 
Set-Cookie: PHPSESSID=qg3bp00ofo92bsgob5flr4co26; path=/ 
Expires: Thu, 19 Nov 1981 08:52:00 GMT 
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0 
Pragma: no-cache 
Link: <https://www.example.org/wp-json/>; rel="https://api.w.org/" 
Link: <https://www.example.org/>; rel=shortlink 
X-Powered-By: EasyEngine 3.7.4 

2ºTESTリダイレクトURL

~# curl -I http://example.org 
HTTP/1.1 301 Moved Permanently 
Server: nginx 
Date: Wed, 23 Aug 2017 20:05:56 GMT 
Content-Type: text/html 
Content-Length: 178 
Connection: keep-alive 
Location: https://www.example.org/ 
X-Powered-By: EasyEngine 3.7.4 
+0

に送信するには?それは何にリダイレクトしていますか? –

+0

OKであるすべてのURLは、リダイレクトを正しく行い、wwwで開くことです。 – Fernando

答えて

1

あなたBLOCK NAME SERVERブロックからchefclub.com.brを削除し、あなたが聞くような新しいサーバブロック

server { 
    listen 443 ssl; 
    server_name chefclub.com.br; 
    include yoursslcertificate.conf; 
    return 301 https://www.chefclub.com.br$request_uri; 
} 

を追加ポートのために80は、あなたもnon-www聴きたい、443ポートをwww 1へのすべてのトラフィックをリダイレクトして、 `https://www.chefclub.com.br/意味ok`リダイレクトどういうwww

+0

残念ながら、それは私のためにはうまくいきませんでした。私のリダイレクトは、サーバー上で2つのブロックを使用する場合にのみ機能します。そうすれば、すべてのリダイレクトが機能します。 しかし、彼らはこれが間違っていると私に言った。 – Fernando

+0

他のブロックから 'chefclub.com.br'を削除しましたか?これは間違いなく働くと思われます。 –

+0

はい、私が理解する限り、私はそれをしました。 しかし、エラーです。 私のリダイレクトはこのようにしか動作しません。 どうぞご覧ください。 https://www.screencast.com/t/VaqSWTbqggF ありがとうございました! – Fernando

関連する問題